[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Daemontools



On Wed, Jan 31, 2001 at 11:15:20AM +1100, Sam Johnston wrote:
> programs running under daemontools usually do so by having a directory 
> linked in /service (which should probably actually be /var/service, or 
> at least a link to it). this directory contains a shell script ('run'). 
> at boot one runs svscan on [/var]/service which starts supervise on each 

Why not /etc/service?

> this probably makes it difficult to start/stop services from /etc/init.d 
> - perhaps it'd be better not to use svscan at all, and use init scripts 
> to start supervise manually on a given directory, and then start/stop 
> would use 'svc' to control the service. is this how it's done currently?

DAEMON=daemon           # real name here, eh
DESC=some description

case "$1" in
  start)
        echo -n "Starting $DESC: "
        svc -u /etc/service/$DAEMON
        if [ -d /etc/service/$DAEMON/log ]; then
                svc -u /etc/service/$DAEMON/log
        fi
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        svc -d /etc/service/$DAEMON
        if [ -d /etc/service/$DAEMON/log ]; then
                svc -d /etc/service/$DAEMON/log
        fi
        echo "$NAME."
        ;;
  #reload)
        #
        #       If the daemon can reload its config files on the fly
        #       for example by sending it SIGHUP, do it here.
        #
        #       If the daemon responds to changes in its config file
        #       directly anyway, make this a do-nothing entry.
        #
        # echo "Reloading $DESC configuration files."
        # svc -h /etc/service/$DAEMON
  #;;
  restart|force-reload)
        #
        #       If the "reload" option is implemented, move the "force-reload"
        #       option to the "reload" entry above. If not, "force-reload" is
        #       just the same as "restart".
        #
        echo -n "Restarting $DESC: "
        svc -d /etc/service/$DAEMON
        sleep 1
        svc -u /etc/service/$DAEMON
        echo "$NAME."
        ;;
  *)
        N=/etc/init.d/$NAME
        # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

Existing links work as designed (though the above script might be afu;
I'm hungry and in a hurry :)

-- 
Nathan Norman - Staff Engineer | A good plan today is better
Micromuse Inc.                 | than a perfect plan tomorrow.
mailto:nnorman@micromuse.com   |   -- Patton

Attachment: pgpsDfNnGUen6.pgp
Description: PGP signature


Reply to: