wok-next view dhid/stuff/dhid @ rev 21144
Small updates.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sat Jan 26 15:54:42 2019 +0200 (2019-01-26) |
parents | 7f188676b59c |
children |
line source
1 #!/bin/sh
2 #
3 # /etc/init.d/dhid: Start, stop and restart dhis daemon on SliTaz
4 #
5 . /etc/init.d/rc.functions
6 #. /etc/daemons.conf
8 NAME=DHID
9 DESC="$(_ 'DHIS client daemon')"
10 DAEMON=/usr/sbin/dhid
11 PIDFILE=/run/dhid.pid
12 OPTIONS="-P $PIDFILE"
14 case "$1" in
15 start)
16 if active_pidfile $PIDFILE dhid; then
17 _ '%s is already running.' $NAME
18 exit 1
19 fi
20 action 'Starting %s: %s...' "$DESC" $NAME
21 $DAEMON $OPTIONS
22 status
23 ;;
24 stop)
25 if ! active_pidfile $PIDFILE dhid; then
26 _ '%s is not running.' $NAME
27 exit 1
28 fi
29 action 'Stopping %s: %s...' "$DESC" $NAME
30 kill $(cat $PIDFILE)
31 rm $PIDFILE
32 status
33 ;;
34 restart)
35 if ! active_pidfile $PIDFILE dhid; then
36 _ '%s is not running.' $NAME
37 exit 1
38 fi
39 action 'Restarting %s: %s...' "$DESC" $NAME
40 kill $(cat $PIDFILE)
41 rm $PIDFILE
42 sleep 2
43 $DAEMON $OPTIONS
44 status
45 ;;
46 *)
47 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
48 newline
49 exit 1
50 ;;
51 esac
53 exit 0