wok annotate mpd/stuff/etc/init.d/mpd @ rev 19161
Typos in "daemon"...
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri May 27 01:40:23 2016 +0300 (2016-05-27) |
parents | 7f188676b59c |
children |
rev | line source |
---|---|
pascal@10908 | 1 #!/bin/sh |
al@19161 | 2 # /etc/init.d/mpd: Start, stop and restart mpd daemon on SliTaz, at boot |
pascal@10908 | 3 # time or with the command line. |
pascal@10908 | 4 # |
pascal@10908 | 5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS |
pascal@10908 | 6 # variable of /etc/rcS.conf and configure options with /etc/mpd.conf. |
pascal@10908 | 7 # |
pascal@10908 | 8 . /etc/init.d/rc.functions |
pascal@10908 | 9 |
pascal@10908 | 10 NAME=mpd |
al@19159 | 11 DESC="$(_ 'Music Player Daemon')" |
pascal@10908 | 12 DAEMON=/usr/sbin/mpd |
pascal@10908 | 13 OPTION="/etc/mpd.conf" |
pascal@15577 | 14 PIDFILE="/var/run/mpd.pid" |
pascal@10908 | 15 |
pascal@10908 | 16 case "$1" in |
al@19159 | 17 start) |
al@19159 | 18 if active_pidfile $PIDFILE mpd ; then |
al@19159 | 19 _ '%s is already running.' $NAME |
al@19159 | 20 exit 1 |
al@19159 | 21 fi |
al@19159 | 22 action 'Starting %s: %s...' "$DESC" $NAME |
al@19159 | 23 $DAEMON $OPTION 2>/dev/null |
al@19159 | 24 status |
al@19159 | 25 pidof $NAME > $PIDFILE |
al@19159 | 26 ;; |
al@19159 | 27 stop) |
al@19159 | 28 if ! active_pidfile $PIDFILE mpd ; then |
al@19159 | 29 _ '%s is not running.' $NAME |
al@19159 | 30 exit 1 |
al@19159 | 31 fi |
al@19159 | 32 action 'Stopping %s: %s...' "$DESC" $NAME |
al@19159 | 33 kill $(pidof $NAME) |
al@19159 | 34 status |
al@19159 | 35 ;; |
al@19159 | 36 restart) |
al@19159 | 37 if ! active_pidfile $PIDFILE mpd ; then |
al@19159 | 38 _ '%s is not running.' $NAME |
al@19159 | 39 exit 1 |
al@19159 | 40 fi |
al@19159 | 41 action 'Restarting %s: %s...' "$DESC" $NAME |
al@19159 | 42 kill $(pidof $NAME) |
al@19159 | 43 sleep 2 |
al@19159 | 44 $DAEMON $OPTION 2>/dev/null |
al@19159 | 45 status |
al@19159 | 46 ;; |
al@19159 | 47 *) |
al@19159 | 48 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19159 | 49 newline |
pascal@15577 | 50 exit 1 |
al@19159 | 51 ;; |
pascal@10908 | 52 esac |
pascal@10908 | 53 |
pascal@10908 | 54 exit 0 |