summaryrefslogtreecommitdiffstats
path: root/modules/noise/init.d
diff options
context:
space:
mode:
authorroot <root@krebs>2011-05-05 09:45:18 +0200
committerroot <root@krebs>2011-05-05 09:47:58 +0200
commit13d7ab68a3dfe881fffdcca16aa9f6ea56b2d583 (patch)
tree63ee04614f903e8f45bf2e3632020b13d16d6dc5 /modules/noise/init.d
parent548e5e53d3bcfec31c1fb89d61da3405aec50924 (diff)
parent4b65c37645b6b72a0531fbbdb75310bf93ee99de (diff)
Merge branch 'import-noise'
Diffstat (limited to 'modules/noise/init.d')
-rwxr-xr-xmodules/noise/init.d/noise48
1 files changed, 48 insertions, 0 deletions
diff --git a/modules/noise/init.d/noise b/modules/noise/init.d/noise
new file mode 100755
index 00000000..991f14b7
--- /dev/null
+++ b/modules/noise/init.d/noise
@@ -0,0 +1,48 @@
+#!/bin/sh -e
+### BEGIN INIT INFO
+# Provides: noise
+# Required-Start: $remote_fs $syslog dbus
+# Required-Stop: $remote_fs $syslog dbus
+# Default-Start: 2 3 4 5
+# Default-Stop: 1
+# Short-Description: Start the noise "Telnet" server
+# Description: System mode startup script for
+# the noise "Telnet" server.
+### END INIT INFO
+
+DAEMON=/root/noise/noise-server
+
+test -x $DAEMON || exit 1
+
+noise_pid() {
+ ps aux | grep tcpserver | grep noise-as-user | awk '{print$2}'
+}
+
+noise_start() {
+ "$DAEMON" &
+}
+
+noise_stop() {
+ kill "`noise_pid`"
+}
+
+case "$1" in
+ start|stop)
+ noise_${1}
+ ;;
+ restart|reload|force-reload)
+ noise_stop
+ noise_start
+ ;;
+ #force-stop) ;;
+ status)
+ kill -s 0 "`noise_pid`"
+ exit $?
+ ;;
+ *)
+ echo "Usage: /etc/init.d/noise {start|stop|force-stop|restart|reload|force-reload|status}"
+ exit 1
+ ;;
+esac
+
+exit 0