PageRenderTime 90ms CodeModel.GetById 85ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/rc0.d/K20distmp3

http://github.com/brinkman83/bashrc
Shell | 63 lines | 42 code | 11 blank | 10 comment | 6 complexity | 5a9dd89b1d6fcfab01250d8a35ad1b18 MD5 | raw file
 1#! /bin/sh
 2### BEGIN INIT INFO
 3# Provides:          distmp3
 4# Required-Start:    $remote_fs $syslog
 5# Required-Stop:     $remote_fs $syslog
 6# Default-Start:     2 3 4 5
 7# Default-Stop:      0 1 6
 8### END INIT INFO
 9
10# distmp3host	Start/stop distmp3.
11# Version:	distmp3host  0.1.9-4  04-Mar-2004  joshk@triplehelix.org
12
13
14PATH=/sbin:/bin:/usr/sbin:/usr/bin
15DAEMON=/usr/bin/distmp3host
16NAME=distmp3host
17DESC="distributed audio encoder"
18
19test -f $DAEMON || exit 0
20
21if [ -f "/etc/default/distmp3" ]; then
22  . /etc/default/distmp3
23 
24  if [ "$1" = start ] && [ -n "$runlevel" -o -n "$in_postinst" ] && [ "$STARTME" = 0 ]; then
25    echo "Not starting $DESC: dpkg-reconfigure distmp3 to change."
26    exit 0
27  fi
28
29  if [ -n "$NICELEVEL" ]; then
30    NICE="-N $NICELEVEL"
31  fi
32fi
33        
34set -e
35
36case "$1" in
37  start)
38	echo -n "Starting $DESC: $NAME"
39	start-stop-daemon --start --quiet -c distmp3:distmp3 $NICE --exec $DAEMON
40	echo "."
41	;;
42  stop)
43	echo -n "Stopping $DESC: $NAME"
44	start-stop-daemon --oknodo --stop --quiet \
45	--pidfile /var/run/distmp3/$NAME.pid --signal 15 >/dev/null 
46	echo "."
47	;;
48  restart|force-reload)
49	echo -n "Restarting $DESC: $NAME"
50	start-stop-daemon --stop --quiet --oknodo --pidfile \
51		/var/run/distmp3/$NAME.pid --signal 15 >/dev/null
52	sleep 1
53	start-stop-daemon --start --quiet -c distmp3:distmp3 $NICE --exec $DAEMON
54
55	echo "."
56	;;
57  *)
58	echo "Usage: $0 {start|stop|restart|force-reload}" >&2
59	exit 1
60	;;
61esac
62
63exit 0