From 96299f387057a6e7df1863f3978ca97219e9c725 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 9 Apr 2011 00:42:39 -1100 Subject: init.d/noise: initial commit --- init.d/noise | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 init.d/noise (limited to 'init.d') 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 -- cgit v1.2.3