From 289d51785a79294d234f1de868352edf784394af Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Fri, 4 Oct 2013 18:26:26 +0000 Subject: [PATCH] -- bugs --- go/r3-netstatus/main.go | 8 +++++--- tuer_presence.initscript | 2 +- tuer_status.initscript | 19 +++++++++---------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/go/r3-netstatus/main.go b/go/r3-netstatus/main.go index b65e96e..afebd58 100644 --- a/go/r3-netstatus/main.go +++ b/go/r3-netstatus/main.go @@ -42,8 +42,6 @@ func init() { flag.BoolVar(&enable_syslog_, "syslog", false, "enable logging to syslog") flag.BoolVar(&enable_debug_, "debug", false, "enable debug logging") flag.Parse() - if enable_syslog_ { LogEnableSyslog(); r3xmppbot.LogEnableSyslog() } - if enable_debug_ { LogEnableDebuglog(); r3xmppbot.LogEnableDebuglog() } } //------- @@ -120,6 +118,10 @@ func EventToXMPP(ps *pubsub.PubSub, xmpp_presence_events_chan_ chan <- interface } func main() { + if enable_syslog_ { LogEnableSyslog(); r3xmppbot.LogEnableSyslog() } + if enable_debug_ { LogEnableDebuglog(); r3xmppbot.LogEnableDebuglog() } + Syslog_.Print("started") + defer Syslog_.Print("exiting") zmqctx, zmqsub := ZmqsInit(r3eventssub_port_) defer zmqctx.Close() if zmqsub != nil {defer zmqsub.Close()} @@ -143,7 +145,7 @@ func main() { } else { fmt.Println(xmpperr) fmt.Println("XMPP Bot disabled") - Syslog_.Printf("XMPP Bot disabled due to error: %s", xmpperr) + Syslog_.Printf("XMPP Bot disabled due to error: %s", xmpperr.Error()) } // --- get update on most recent events --- diff --git a/tuer_presence.initscript b/tuer_presence.initscript index 0972666..f816b06 100755 --- a/tuer_presence.initscript +++ b/tuer_presence.initscript @@ -10,7 +10,7 @@ ### END INIT INFO EXE_TRACK=/flash/tuer/r3-eventbroker_zmq -CFG_TRACK="" +CFG_TRACK="--syslog" . /etc/default/tuer diff --git a/tuer_status.initscript b/tuer_status.initscript index d4cd7ff..bc465cd 100755 --- a/tuer_status.initscript +++ b/tuer_status.initscript @@ -11,14 +11,13 @@ EXE_UWEB=/flash/tuer/r3-netstatus STATE_DIR=/flash/var/lib/r3netstatus/ -CFG_UWEB="" +CFG_UWEB="-syslog" . /etc/default/tuer [ -n "$XMPPJID" ] && CFG_UWEB="$CFG_UWEB --xjid $XMPPJID" [ -n "$XMPPPASS" ] && CFG_UWEB="$CFG_UWEB --xpass $XMPPPASS" [ -n "$XMPPBOTAUTH" ] && CFG_UWEB="$CFG_UWEB --xbotauth $XMPPBOTAUTH" -[ -n "$PRESENCE_SOCKET" ] && CFG_UWEB="$CFG_UWEB --presencesocket $PRESENCE_SOCKET" PIDFILE_UWEB=${DIR_RUN}/r3-netstatus.pid @@ -41,17 +40,17 @@ fi # and tasks running under it. case "$1" in -start) - log_daemon_msg "Starting door daemon" "update-web-status" - start-stop-daemon --start --quiet --pidfile $PIDFILE_UWEB -b -m -c $DOOR_USR --startas $EXE_UWEB -- $CFG_UWEB - log_end_msg $? +start) + log_daemon_msg "Starting xmpp and web status daemon" r3-netstatus + start-stop-daemon --start --quiet --pidfile $PIDFILE_UWEB -b -m -c $DOOR_USR --startas $EXE_UWEB -- $CFG_UWEB + log_end_msg $? ;; stop) - log_daemon_msg "Stopping door daemon" "update-web-status" - start-stop-daemon --stop --quiet --pidfile $PIDFILE_UWEB -m --retry TERM/1/TERM/1/KILL - log_end_msg $? + log_daemon_msg "Stopping xmpp and web status daemon" r3-netstatus + start-stop-daemon --stop --quiet --pidfile $PIDFILE_UWEB -m --retry TERM/1/TERM/1/KILL + log_end_msg $? ;; -restart) +restart) $0 stop $0 start ;; -- 1.7.10.4