* abcde.conf, abcde, abcde.1
[abcde.git] / examples / abcde.init
1 #!/bin/sh
2
3 ##########
4 # The first argument tells what to do.
5 ##########
6
7 RUNNING=`ps -ef|grep [a]bcded|awk '{ print $2 }'`
8
9 state=$1
10
11 case $state in
12 start)
13
14         if [ -n "$RUNNING"  ]; then
15                 echo "abcde daemon already running."
16                 exit 0
17         fi
18
19         echo "Starting abcde daemon"
20         abcded &
21         echo "Done."
22         ;;
23 stop)
24         if [ -n "$RUNNING"  ]; then
25            /bin/kill -9 $RUNNING > /dev/null
26            if [ $? = 0 ]; then
27                 echo "abcde daemon killed"
28            fi
29         fi
30         ;;
31 restart)
32         $0 stop
33         $0 start
34         ;;
35 *)
36         echo "Usage: $0 {start|stop|restart}"
37         exit 1
38 esac
39