X-Git-Url: https://git.hcoop.net/clinton/abcde.git/blobdiff_plain/40c61684c009618f1180fc5e02b6d469a7d4bfb1..7acef70b718082c76c122caae92aadb4bbb55ef1:/examples/abcde.init diff --git a/examples/abcde.init b/examples/abcde.init new file mode 100644 index 0000000..b10fb05 --- /dev/null +++ b/examples/abcde.init @@ -0,0 +1,39 @@ +#!/bin/sh + +########## +# The first argument tells what to do. +########## + +RUNNING=`ps -ef|grep [a]bcded|awk '{ print $2 }'` + +state=$1 + +case $state in +start) + + if [ -n "$RUNNING" ]; then + echo "abcde daemon already running." + exit 0 + fi + + echo "Starting abcde daemon" + abcded & + echo "Done." + ;; +stop) + if [ -n "$RUNNING" ]; then + /bin/kill -9 $RUNNING > /dev/null + if [ $? = 0 ]; then + echo "abcde daemon killed" + fi + fi + ;; +restart) + $0 stop + $0 start + ;; +*) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac +