wok-next view lxnetdaemon/stuff/etc/init.d/lxnetdaemon @ rev 11693

lxnetdaemon: update start script
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 18 17:39:51 2012 +0100 (2012-02-18)
parents 2dfe82a2e117
children 7f188676b59c
line source
1 #!/bin/sh
2 # /etc/init.d/lxnetdaemon: Start, stop and restart LXnetdaemon deamon on
3 # SliTaz, at boot time or with the command line.
4 #
5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=LXnetdaemon
12 DESC="Network daemon"
13 DAEMON=/usr/bin/lxnetdaemon
14 PIDFILE=/var/run/lxnetdaemon.pid
16 case "$1" in
17 start)
18 if active_pidfile $PIDFILE lxnetdaemon ; then
19 echo "$NAME already running."
20 exit 1
21 fi
22 echo -n "Starting $DESC: $NAME... "
23 $DAEMON $OPTIONS
24 status
25 pidof lxnetdaemon > $PIDFILE
26 ;;
27 stop)
28 if ! active_pidfile $PIDFILE lxnetdaemon ; then
29 echo "$NAME is not running."
30 exit 1
31 fi
32 echo -n "Stopping $DESC: $NAME... "
33 kill `cat $PIDFILE`
34 rm $PIDFILE
35 status
36 ;;
37 restart)
38 if ! active_pidfile $PIDFILE lxnetdaemon ; then
39 echo "$NAME is not running."
40 exit 1
41 fi
42 echo -n "Restarting $DESC: $NAME... "
43 kill `cat $PIDFILE`
44 rm $PIDFILE
45 sleep 2
46 $DAEMON $OPTIONS
47 status
48 pidof lxnetdaemon > $PIDFILE
49 ;;
50 *)
51 echo ""
52 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
53 echo ""
54 exit 1
55 ;;
56 esac
58 exit 0