initscript and correct address
[svn42.git] / uc_sensor_node_zmq.initscript
diff --git a/uc_sensor_node_zmq.initscript b/uc_sensor_node_zmq.initscript
new file mode 100755 (executable)
index 0000000..a3dec6c
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+# Start/stop the tuer status updater.
+#
+### BEGIN INIT INFO
+# Provides:          uc_sensor_node_zmq
+# Required-Start:    $remote_fs $syslog $time
+# Required-Stop:     $remote_fs $syslog $time
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+### END INIT INFO
+
+EXE_NODE=/home/realraum/uc_sensor_node_zmq
+CFG_NODE=""
+DIR_RUN=/var/run
+DOOR_USR=realraum
+DOOR_GRP=nogroup
+
+#. /etc/default/tuer
+
+PIDFILE_NODE=/var/run/uc_sensor_node_zmq.pid
+
+test -f $EXE_NODE  || exit 1
+if [ ! -d $DIR_RUN ]; then
+       mkdir -p $DIR_RUN || exit 2
+       chown -R $DOOR_USR:$DOOR_GRP $DIR_RUN
+fi
+
+. /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 daemon" uc_sensor_node_zmq
+  start-stop-daemon --start --quiet --pidfile $PIDFILE_NODE -b -m -c $DOOR_USR --startas $EXE_NODE  -- $CFG_NODE
+  log_end_msg $?
+       ;;
+stop)
+  log_daemon_msg "Stopping daemon" uc_sensor_node_zmq
+  start-stop-daemon --stop --quiet --pidfile $PIDFILE_NODE -m --retry TERM/1/TERM/1/KILL
+  log_end_msg $?
+        ;;
+restart)
+       $0 stop
+       $0 start
+        ;;
+*)     log_action_msg "Usage: $0 {start|stop|restart|reload|force-reload}"
+        exit 2
+        ;;
+esac
+exit 0