]> git.pld-linux.org Git - packages/darkice.git/blob - darkice.init
823b0551bf336b067c5d98b0faa95b68436ec272
[packages/darkice.git] / darkice.init
1 #!/bin/sh
2 #
3 # darkice       This shell script takes care of starting and stopping darkice
4 #
5 # chkconfig:    345 97 23
6 # description:  Darkice is a stream provider for IceCast/ShoutCast servers
7
8 # Source function library
9 . /etc/rc.d/init.d/functions
10
11 # Get network config
12 . /etc/sysconfig/network
13
14 # Check that networking is up.
15 if is_yes "${NETWORKING}"; then
16         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
17                 msg_network_down darkice
18                 exit 1
19         fi
20 else
21         exit 0
22 fi
23
24 RETVAL=0
25 # See how we were called.
26 case "$1" in
27   start)
28         # Check if the service is already running?
29         if [ ! -f /var/lock/subsys/darkice ]; then
30                 msg_starting darkice
31                 busy
32                 daemon /usr/sbin/daemon -u darkice -o /var/log/darkice.log -P /var/run/darkice -n darkice -- /usr/bin/darkice -c /etc/darkice.cfg >/dev/null
33                 RETVAL=$?
34                 [ $RETVAL -eq 0 ] && ok || fail
35                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/darkice
36         else
37                 msg_already_running Darkice
38         fi
39         ;;
40   stop)
41         # Stop daemons.
42         if [ -f /var/lock/subsys/darkice ]; then
43                 msg_stopping darkice
44                 busy
45                 /usr/sbin/daemon -P /var/run/darkice -n darkice --stop >/dev/null && ok || fail
46                 rm -f /var/lock/subsys/darkice >/dev/null 2>&1
47         else
48                 msg_not_running Darkice
49         fi
50         ;;
51   restart)
52         $0 stop
53         $0 start
54         ;;
55   status)
56         status darkice
57         /usr/sbin/daemon -P /var/run/darkice --verbose --running -n darkice
58         exit $?
59         ;;
60   *)
61         msg_usage "$0 {start|stop|restart|status}"
62         exit 3
63 esac
64
65 exit $RETVAL
This page took 0.133125 seconds and 2 git commands to generate.