EXE_DOOR=/flash/tuer/door_daemon
EXE_CARD=/flash/tuer/checkcard.pl
EXE_UWEB=/flash/tuer/update-web-status.py
+EXE_XMPP=/flash/tuer/update-xmpp-status.py
DIR_RUN=/var/run/tuer
CFG_UWEB=/flash/tuer/update-web-status.cfg
+CFG_XMPP=/flash/tuer/update-xmpp-status.cfg
DOOR_SOCKET=${DIR_RUN}/door_cmd.socket
DOOR_DEV=/dev/door
PIDFILE1=${DIR_RUN}/door_daemon.pid
PIDFILE2=${DIR_RUN}/checkcard.pid
PIDFILE3=${DIR_RUN}/update-web-status.pid
+PIDFILE4=${DIR_RUN}/update-xmpp-status.pid
test -f $EXE_DOOR || exit 1
test -f $EXE_CARD || exit 1
log_daemon_msg "Starting door daemon" "update-web-status"
start-stop-daemon --start --quiet --pidfile $PIDFILE3 -b -m -c $DOOR_USR --name update-web-status.py --startas $EXE_UWEB -- $DOOR_SOCKET $CFG_UWEB
log_end_msg $?
+ log_daemon_msg "Starting door daemon" "update-xmpp-status"
+ start-stop-daemon --start --quiet --pidfile $PIDFILE4 -b -m -c $DOOR_USR --name update-xmpp-status.py --startas $EXE_XMPP -- $DOOR_SOCKET $CFG_XMPP
+ log_end_msg $?
;;
stop)
log_daemon_msg "Stopping door daemon" "door_daemon"
log_daemon_msg "Stopping door daemon" "update-web-status"
start-stop-daemon --stop --quiet --pidfile $PIDFILE3 -m --retry TERM/1/TERM/1/KILL
log_end_msg $?
+ log_daemon_msg "Stopping door daemon" "update-xmpp-status"
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE4 -m --retry TERM/1/TERM/1/KILL
+ log_end_msg $?
killall "mifare-read" 2>/dev/null
;;
restart)
import sys
#import threading
import logging
+import logging.handlers
import urllib
import time
import signal
import types
import ConfigParser
-logging.basicConfig(
- level=logging.INFO,
- #level=f,
- #level=logging.DEBUG,
- filename='/var/log/tmp/update-web-status.log',
- format="%(asctime)s %(message)s",
- datefmt="%Y-%m-%d %H:%M:%S"
- )
+logger = logging.getLogger()
+logger.setLevel(logging.INFO)
+lh_syslog = logging.handlers.SysLogHandler(address="/dev/log",facility=logging.handlers.SysLogHandler.LOG_LOCAL2)
+lh_syslog.setFormatter(logging.Formatter('update-web-status.py: %(levelname)s %(message)s'))
+logger.addHandler(lh_syslog)
+lh_stderr = logging.StreamHandler()
+logger.addHandler(lh_stderr)
class UWSConfig:
def __init__(self,configfile=None):
f.read()
f.close()
except Exception, e:
- logging.error("tochURL: "+str(e))
+ logging.error("touchURL: "+str(e))
def displayOpen():
touchURL(uwscfg.url_open)
if resource:
sendxmpp_cmd += "-r %s " % resource
if noofflinemsg:
- sendxmpp_cmd += "--headline "
+ sendxmpp_cmd += "--message-type=headline "
sendxmpp_cmd += recipients
if addtimestamp:
import sys
#import threading
import logging
+import logging.handlers
import urllib
import time
import signal
import types
import ConfigParser
-logging.basicConfig(
- level=logging.INFO,
- #level=f,
- #level=logging.DEBUG,
- filename='/var/log/tmp/update-xmpp-status.log',
- format="%(asctime)s %(message)s",
- datefmt="%Y-%m-%d %H:%M:%S"
- )
+logger = logging.getLogger()
+logger.setLevel(logging.INFO)
+#logger.setLevel(logging.DEBUG)
+lh_syslog = logging.handlers.SysLogHandler(address="/dev/log",facility=logging.handlers.SysLogHandler.LOG_LOCAL2)
+lh_syslog.setFormatter(logging.Formatter('update-xmpp-status.py: %(levelname)s %(message)s'))
+logger.addHandler(lh_syslog)
+lh_stderr = logging.StreamHandler()
+logger.addHandler(lh_stderr)
class UWSConfig:
def __init__(self,configfile=None):
if resource:
sendxmpp_cmd += "-r %s " % resource
if noofflinemsg:
- sendxmpp_cmd += "--headline "
+ sendxmpp_cmd += "--message-type=headline "
sendxmpp_cmd += recipients
if addtimestamp:
f.read()
f.close()
except Exception, e:
- logging.error("tochURL: "+str(e))
+ logging.error("touchURL: "+str(e))
def displayOpen():
distributeXmppMsg(uwscfg.xmpp_msg_opened % action_by)