]> git.pld-linux.org Git - packages/ices.git/blobdiff - ices.init
- NFY 2,
[packages/ices.git] / ices.init
index 9d41dd0e00cc5e5ab5cd85090bf66e4bfa379e76..58c2168308678c5c2d3e38219db00c9d153cc071 100644 (file)
--- a/ices.init
+++ b/ices.init
@@ -3,9 +3,9 @@
 # ices         This shell script takes care of starting and stopping
 #              ices.
 #
-# chkconfig: 345 96 24
-# description: Icecast is an Internet audio broadcasting system based on
-#              MPEG audio technology. Ices is a streamer for icecast.
+# chkconfig:   345 96 24
+# description: Icecast is an Internet audio broadcasting system based on \
+#              MPEG audio technology. Ices is a streamer for icecast.
 
 # Source function library.
 . /etc/rc.d/init.d/functions
 . /etc/sysconfig/network
 
 # Check that networking is up.
-[ ${NETWORKING} = "no" ] && exit 0
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down ices
+               exit 1
+       fi
+else
+       exit 0
+fi
 
 # Check that ices.conf exists.
-[ -f /etc/icecast/ices.conf ] || exit 0
+[ -f /etc/icecast/ices.xml ] || (echo \
+'There are three config files:
+/etc/icecast/ices-oss.xml - conf for oss;
+/etc/icecast/ices-alsa.xml - conf for alsa;
+/etc/icecast/ices-playlist.xml - conf for playlist;
+After choosing one of them you have to configure it before run and rename 
+to /etc/icecast/ices.xml. Enjoy!                             Your PLD Team'\
+&& exit 0)
 
 
 # See how we were called.
 case "$1" in
   start)
-        # Start daemons.
-       msg_starting ices
-       # daemon --user icecast -s /bin/sh 'ices'
-       # Our daemon function doesn't include su's --shell function
-       su icecast -s /bin/sh -c 'ices -B' > /dev/null
-       ok
-       touch /var/lock/subsys/ices
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/ices ]; then
+               # Start daemons.
+               msg_starting ices
+               # daemon --user icecast -s /bin/sh 'ices'
+               # Our daemon function doesn't include su's --shell function
+               su icecast -s /bin/sh -c 'ices /etc/ices/ices.xml'
+               touch /var/lock/subsys/ices
+       else
+               msg_already_running ices
+       fi
        ;;
   stop)
-        # Stop daemons.
-       msg_stopping ices
-       killproc ices 2> /dev/null
-       rm -f /var/lock/subsys/ices
+       if [ -f /var/lock/subsys/ices ]; then
+               # Stop daemons.
+               msg_stopping ices
+               killproc ices 2> /dev/null
+               rm -f /var/lock/subsys/ices
+       else
+               msg_not_running ices
+       fi
+       ;;
+  restart|force-reload)
+       $0 stop
+       $0 start
+       exit $?
        ;;
-  restart)
-        $0 stop
-        $0 start
-        ;;
   status)
        status ices
+       exit $?
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|status}"
-       exit 1
+       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       exit 3
 esac
 
 exit 0
This page took 0.068187 seconds and 4 git commands to generate.