diff options
author | 2010-07-23 17:07:19 +0300 | |
---|---|---|
committer | 2010-07-23 17:07:19 +0300 | |
commit | dbeb0fd7504d250c3df439775cd87903f7cb67dd (patch) | |
tree | a05acb25241e22172324826c37e2adf80e3ede0a | |
parent | Add command line arguments: --no-daemon and --conf-dir=specify_conf_dir_here (diff) | |
download | idfetch-dbeb0fd7504d250c3df439775cd87903f7cb67dd.tar.gz idfetch-dbeb0fd7504d250c3df439775cd87903f7cb67dd.tar.bz2 idfetch-dbeb0fd7504d250c3df439775cd87903f7cb67dd.zip |
Add /etc/init.d/seggetd script to start|stop|restart|status segget daemon
-rwxr-xr-x | segget/init.d/seggetd | 90 |
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 |