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() }
}
//-------
}
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()}
} 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 ---
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
# 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
;;