File svscan.init of Package daemontools
#! /bin/sh
#
# svscan Start TCP/IP networking services. This script
# starts the daemontools svscan.
#
# Author: Andy Dustman <andy@dustman.net>
# Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
# Various folks at Red Hat
#
# chkconfig: 345 50 50
# description: svscan starts a variety of other internet services, watches \
# for services that are added or deleted, and starts or stops \
# them as needed. It is a general replacement for inetd.
# processname: svscan
# config: /var/services
# pidfile: /var/run/svscan.pid
# Source function library.
#. /etc/rc.d/init.d/functions
# Get config.
# . /etc/sysconfig/network
# Check that networking is up.
#if [ ${NETWORKING} = "no" ]
#then
# exit 0
#fi
RETVAL=0
# XXX daemontools typically in /usr/local/bin
export PATH=$PATH:/usr/local/bin
# See how we were called.
case "$1" in
start)
echo -n $"Starting svscan: "
env - PATH=/usr/local/bin:/usr/sbin:/usr/bin:/bin svscan /var/svscan </dev/null 2>/dev/console >/dev/console &
PID=$$
echo $PID >/var/run/svscan.pid
RETVAL=$?
# [ $RETVAL -eq 0 ] && touch /var/lock/subsys/svscan && success "$base startup" || failure "$base startup"
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/svscan && echo "$base startup succeeded" || echo "$base startup failed"
echo
;;
stop)
echo -n $"Stopping svscan: "
killproc svscan
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/svscan && success "$base shutdown" || failure "$base shutdown"
echo
echo -n "Stopping svscan services: "
svc -dx /var/svscan/* /var/svscan/*/log
RETVAL=$?
# [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/svscan && success "$base shutdown" || failure "$base shutdown"
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/svscan && echo "$base shutdown succeeded" || echo "$base shutdown failed"
echo
;;
status)
status svscan
RETVAL=$?
svstat /var/svscan/* /var/svscan/*/log
;;
restart)
$0 stop
$0 start
RETVAL=$?
;;
*)
echo "Usage: svscan {start|stop|status|restart}"
exit 1
esac
exit $REVAL