wok view mpd/stuff/etc/init.d/mpd @ rev 19159

/etc/init.d/*: use 'action' in pair with 'status'.
'action' returns translated message, so why not to add full translatable /etc/init.d/* content
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu May 26 20:16:45 2016 +0300 (2016-05-26)
parents 8ebec64e4191
children ff5fd8788cd9
line source
1 #!/bin/sh
2 # /etc/init.d/mpd: Start, stop and restart mpd deamon on SliTaz, at boot
3 # 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/mpd.conf.
7 #
8 . /etc/init.d/rc.functions
10 NAME=mpd
11 DESC="$(_ 'Music Player Daemon')"
12 DAEMON=/usr/sbin/mpd
13 OPTION="/etc/mpd.conf"
14 PIDFILE="/var/run/mpd.pid"
16 case "$1" in
17 start)
18 if active_pidfile $PIDFILE mpd ; then
19 _ '%s is already running.' $NAME
20 exit 1
21 fi
22 action 'Starting %s: %s...' "$DESC" $NAME
23 $DAEMON $OPTION 2>/dev/null
24 status
25 pidof $NAME > $PIDFILE
26 ;;
27 stop)
28 if ! active_pidfile $PIDFILE mpd ; then
29 _ '%s is not running.' $NAME
30 exit 1
31 fi
32 action 'Stopping %s: %s...' "$DESC" $NAME
33 kill $(pidof $NAME)
34 status
35 ;;
36 restart)
37 if ! active_pidfile $PIDFILE mpd ; then
38 _ '%s is not running.' $NAME
39 exit 1
40 fi
41 action 'Restarting %s: %s...' "$DESC" $NAME
42 kill $(pidof $NAME)
43 sleep 2
44 $DAEMON $OPTION 2>/dev/null
45 status
46 ;;
47 *)
48 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
49 newline
50 exit 1
51 ;;
52 esac
54 exit 0