summaryrefslogtreecommitdiffstats
path: root/init.d
diff options
context:
space:
mode:
authorroot <root@krebs>2011-04-09 00:42:39 -1100
committerroot <root@krebs>2011-04-09 00:42:39 -1100
commit96299f387057a6e7df1863f3978ca97219e9c725 (patch)
tree0bd5120b0443af85087b04269a581276d6826569 /init.d
parent04f33bfa19ff5a84bc97010b589624f384ee7c06 (diff)
init.d/noise: initial commit
Diffstat (limited to 'init.d')
-rwxr-xr-xinit.d/noise48
1 files changed, 48 insertions, 0 deletions
diff --git a/init.d/noise b/init.d/noise
new file mode 100755
index 00000000..991f14b7
--- /dev/null
+++ b/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