summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'segget/init.d/seggetd')
-rwxr-xr-xsegget/init.d/seggetd90
1 files changed, 90 insertions, 0 deletions
diff --git a/segget/init.d/seggetd b/segget/init.d/seggetd
new file mode 100755
index 0000000..16b83af
--- /dev/null
+++ b/segget/init.d/seggetd
@@ -0,0 +1,90 @@
+#!/bin/sh
+# startup script for seggetd
+
+if [ -f /etc/rc.d/init.d/functions ]; then
+ if [ -f /etc/slackware-version ]; then
+ SYS_F="SL"
+ else
+ . /etc/rc.d/init.d/functions
+ SYS_F="RH"
+ fi
+elif [ -x /sbin/startproc ]; then
+ SYS_F="Su"
+elif [ -x /sbin/start-stop-daemon ]; then
+ SYS_F="De"
+fi
+
+DAEMON=/usr/sbin/seggetd/segget
+CONF_DIR=/etc/seggetd
+LOCKFILE=/var/lock/subsys/seggetd
+
+export PATH=$PATH:/usr/local/sbin:/usr/local/bin
+
+segget_start ()
+{
+ echo -n "Starting ${DAEMON}: "
+
+ if [ "$SYS_F" = "RH" ]; then
+ daemon ${DAEMON} --conf-dir=${CONF_DIR}
+ [ "$?" = "0" ] && touch ${LOCKFILE}
+ echo "."
+ elif [ "$SYS_F" = "Su" ]; then
+ startproc ${DAEMON} --conf-dir=${CONF_DIR}
+ echo "."
+ elif [ "$SYS_F" = "De" ]; then
+ start-stop-daemon --start --quiet --oknodo --exec ${DAEMON} -- --conf-dir=${CONF_DIR}
+ echo "."
+ else
+ `${DAEMON} --conf-dir=${CONF_DIR}`
+ fi
+}
+
+segget_stop ()
+{
+ echo -n "Shutting down ${DAEMON}: "
+
+ if [ "$SYS_F" = "De" ]; then
+ start-stop-daemon --stop --quiet --oknodo --signal 15 --exec ${DAEMON}
+ echo "."
+ elif [ "$SYS_F" = "SL" ]; then
+ kill -KILL `pidof ${DAEMON}`
+ [ "$?" = "0" ] && rm -f ${LOCKFILE}
+ echo
+ else
+ killproc ${DAEMON}
+ [ "$?" = "0" ] && rm -f ${LOCKFILE}
+ echo
+ fi
+}
+
+
+case $1 in
+
+ start)
+ segget_start
+ ;;
+
+ stop)
+ segget_stop
+ ;;
+
+ status)
+ pid=`pidof ${DAEMON}`
+ if [ "${pid}" ]; then
+ echo "${DAEMON} is running, pid: $pid"
+ else
+ echo "${DAEMON} is not running"
+ fi
+ ;;
+
+ restart)
+ segget_stop
+ segget_start
+ ;;
+
+ *)
+ echo "Usage: seggetd {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+exit 0