Projects/SpaceNotifier: verschil tussen versies

Uit Hackerspace Bitlair
Zarya (overleg | bijdragen)
kGeen bewerkingssamenvatting
kGeen bewerkingssamenvatting
Β 
(12 tussenliggende versies door 3 gebruikers niet weergegeven)
Regel 1: Regel 1:
{{Project
{{Project
|name=Project/SpaceNotifier
|name=SpaceNotifier
|URL=http://hier
|start=2011-05-15
|contact=User:AK47
|contact=AK47
|info=Space Notifier apje
|info=Space Notifier
|status=Alpha
|status=Abandoned
|URL=https://github.com/bitlair/SpaceNotifier
}}
}}
App for notifing of the space status
Vervangen door [[Spacestate]].


== sshlogin.exp
== Outline ==
#!/usr/bin/expect -f
App for announcing the space status.
# Expect script to supply root/admin password for remote ssh server
# and execute command.
# This script needs three argument to(s) connect to remote server:
# password = Password of remote UNIX server, for root user.
# ipaddr = IP Addreess of remote UNIX server, no hostname
# scriptname = Path to remote script which will execute on remote server
# For example:
#Β  ./sshlogin.exp password 192.168.1.11 who
# ------------------------------------------------------------------------
# Copyright (c) 2004 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# ----------------------------------------------------------------------
# set Variables
set password [lrange $argv 0 0]
set ipaddr [lrange $argv 1 1]
set scriptname [lrange $argv 2 2]
set arg1 [lrange $argv 3 3]
set timeout -1
# now connect to remote UNIX box (ipaddr) with given script to execute
spawn ssh -p 22 -o "PubkeyAuthentication no" admin@$ipaddr
match_max 100000
expect "*?assword:*"
send -- "$password\r"
expect "*ProCurve*"
send -- "sh stations\r"
expect "*ProCurve*"
send -- "exit\r"
expect eof


== space_state.sh ==
* Based upon associatied clients on one or more accesspoints.
#!/bin/bash
* Only known mac addresses can open or close the space.
USERS=`./sshlogin.exp <PASSWORD> 192.168.88.2 | grep -c Bitlair`
* PHP-CLI based, database via PDO (MySQL etc)
STATE=`cat /tmp/spacestate 2>/dev/null`
* Supported AP's currently:
if [ $USERS -gt 0 ]; then
** HP ProCurve AP530 (via HTTP)
Β  Β  if [ "$STATE" != "open" ]; then
** MikroTik RouterOS (via SNMP)
Β  Β  Β  Β  echo "WE MOETEN OPEN"
* Check the GitHub-url for the code :)
Β  Β  Β  Β  echo "open" > /tmp/spacestate
Β 
Β  Β  fi
== Power switchting based on status ==
fi
We are currently switching the following devices based on space-status:
if [ $USERS -lt 1 ]; then
Β 
Β  Β  if [ "$STATE" != "dicht" ]; then
* Cisco IP phones
Β  Β  Β  Β  echo "WE MOETEN DICHT"
* Trollibox
Β  Β  Β  Β  echo "dicht" > /tmp/spacestate
* LED-board
Β  Β  fi
fi

Huidige versie van 22 jan 2026 21:54


Project: SpaceNotifier
Beschrijving Space Notifier
Start 2011-05-15
Contact AK47
Status Abandoned
Website https://github.com/bitlair/SpaceNotifier

Vervangen door Spacestate.

Outline

App for announcing the space status.

  • Based upon associatied clients on one or more accesspoints.
  • Only known mac addresses can open or close the space.
  • PHP-CLI based, database via PDO (MySQL etc)
  • Supported AP's currently:
    • HP ProCurve AP530 (via HTTP)
    • MikroTik RouterOS (via SNMP)
  • Check the GitHub-url for the code :)

Power switchting based on status

We are currently switching the following devices based on space-status:

  • Cisco IP phones
  • Trollibox
  • LED-board