From: realraum Date: Wed, 13 May 2009 15:24:15 +0000 (+0000) Subject: stuff X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=f30712da87abd222feadede56453c384e37d488f;p=svn42.git stuff --- diff --git a/checkcard.pl b/checkcard.pl index ade7c61..18109d4 100755 --- a/checkcard.pl +++ b/checkcard.pl @@ -12,10 +12,11 @@ my $socketaddr = sockaddr_un($socketfile); my $keys; my %good; -open $keys,'/flash/realraum/keys'; +open $keys,'/flash/keys'; while (<$keys>) { - if ($_ =~ /([0-9A-Fa-f]{8})\s(\S+)/) + chomp; + if ($_ =~ /^([0-9A-Fa-f]{8})\s+(.+)$/) { $good{$1}=$2; } @@ -31,7 +32,7 @@ sub send_to_fifo while (sleep 1) { - open $fh,'/flash/realraum/mifare-read 0 2>&1 |'; + open $fh,'/flash/tuer_python/mifare-read 0 2>&1 |'; while (<$fh>) { next unless /UID/; diff --git a/tuer b/tuer new file mode 100755 index 0000000..a6449a1 --- /dev/null +++ b/tuer @@ -0,0 +1,50 @@ +#!/bin/sh +# Start/stop the tuer daemon. +# +### BEGIN INIT INFO +# Provides: tuer +# Required-Start: $remote_fs $syslog $time +# Required-Stop: $remote_fs $syslog $time +# Default-Start: 2 3 4 5 +# Default-Stop: 1 +### END INIT INFO + + +test -f /flash/tuer_python/door_daemon.py || exit 0 +test -f /flash/tuer_python/checkcard.pl || exit 0 + +PIDFILE1=/var/run/door_daemon.pid +PIDFILE2=/var/run/checkcard.pid + +. /lib/lsb/init-functions + +# Read the system's locale and set cron's locale. This locale +# will be inherited by cron (used to set charset of emails) +# and tasks running under it. + +case "$1" in +start) + log_daemon_msg "Starting door daemon" "door_daemon" + start-stop-daemon --start --quiet --pidfile $PIDFILE1 -b -m --name door_daemon.py --startas /flash/tuer_python/door_daemon.py -- + log_end_msg $? + log_daemon_msg "Starting door daemon" "checkcard" + start-stop-daemon --start --quiet --pidfile $PIDFILE2 -b -m --name checkcard.pl --startas /flash/tuer_python/checkcard.pl -- + log_end_msg $? + ;; +stop) + log_daemon_msg "Stopping door daemon" "door_daemon" + start-stop-daemon --stop --quiet --pidfile $PIDFILE1 -m --name door_daemon.py + log_end_msg $? + log_daemon_msg "Stopping door daemon" "checkcard" + start-stop-daemon --stop --quiet --pidfile $PIDFILE2 -m --name checkcard.pl + log_end_msg $? + ;; +restart) + $0 stop + $0 start + ;; +*) log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload}" + exit 2 + ;; +esac +exit 0