#!/bin/bash # ape This shell script takes care of starting and stopping # ape stream server # # chkconfig: 345 90 25 # description: ape - ape streaming server # pidfile: /var/run/ape.pid # config: /etc/ape/ape.conf ### BEGIN INIT INFO # Provides: ape # Required-Start: $network # Required-Stop: $network # Should-Start: $named # Should-Stop: $named # Short-Description: Starts the squid daemon # Description: ape is streaming server. # ### END INIT INFO PATH=/usr/bin:/sbin:/bin:/usr/sbin export PATH # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 if [ -f /etc/sysconfig/ape ]; then . /etc/sysconfig/ape fi # check if the ape conf file is present [ -f $APE_CONFIG ] || exit 0 # don't raise an error if the config file is incomplete # set defaults instead: APE_OPTS=${APE_OPTS:-""} ape=/usr/sbin/aped prog=ape RETVAL=0 start() { gprintf "Starting %s: " "$prog" $ape --cfg $APE_CONFIG $APE_OPTS >> /var/log/ape/ape.out 2>&1 RETVAL=$? if [ $RETVAL -eq 0 ]; then pidof $ape > /var/run/ape.pid fi [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog [ $RETVAL -eq 0 ] && success [ $RETVAL -ne 0 ] && failure echo return $RETVAL } stop() { gprintf "Stopping %s: " "$prog" RETVAL=$? if [ $RETVAL -eq 0 ] ; then [ -f //var/run/ape.pid ] && kill `cat /var/run/ape.pid` 2>&1 rm -f /var/lock/subsys/$prob /var/run/ape.pid success; echo else failure; echo fi return $RETVAL } reload() { gprintf "not implemented yet\n" } restart() { stop start } condrestart() { [ -e /var/lock/subsys/ape ] && restart || : } rhstatus() { gprintf "not implemented yet\n" } probe() { return 0 } case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) restart ;; condrestart) condrestart ;; status) rhstatus ;; probe) exit 0 ;; *) gprintf "Usage: %s {start|stop|status|reload|restart|condrestart}\n" "$0" exit 1 esac exit $?