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

Re: Replacing systemd



On Tue, Mar 04, 2014 at 09:37:57AM -0500, Steve Litt wrote:
> On Mon, 3 Mar 2014 22:31:08 -0500
> Dan Ritter <dsr@randomstring.org> wrote:
> > I would strongly consider a hybrid of the existing sysVinit and
> > daemontools or runit -- runit being a reimplementation of daemontools
> > that avoided the licensing issue and has a current maintainer.
> 
> Yeah, I would strongly consider that too. I didn't know I could replace
> systemd with sysVinit once Jessie becomes stable. And I'll research
> runit to see if it's just like Daemontools. I'm really in love with
> Daemontools: It's not just a summer thing.
> 
> > 
> > sysVinit would be in charge of system boot, and runit in charge of
> > daemon supervision.  A few simple modifications allows
> > /etc/init.d/ files to control the runit processes.
> 
> :-) Would those modifications involve linking and unlinking directories
> to the /service (or /etc/service) directory, by any chance?

I wouldn't, no. linking and unlinking is best handled by an
equivalent to update-rc.d. How often do you call that?

Here's a generic /etc/init.d/ file for a supervised
service. 

#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          service
# Required-Start:    $remote_fs $all
# Required-Stop:     $remote_fs $syslog
# Should-Start:      $local_fs
# Should-Stop:       $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: do stuff
# Description:       service is a tool that provides service.
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

$SERVICE=servicename
$SERVICE_USER=username
$SERVICE_GROUP=groupname

#note config file and command line parameters must be specified
#in /etc/service/$SERVICENAME/run

case "$1" in
  start)
	svc -u /etc/service/$SERVICE
        ;;
  stop)
	# do pre-stop actions here
        svc -d /etc/service/$SERVICE
        ;;
  restart)
        svc -d /etc/service/$SERVICE
	svc -u /etc/service/$SERVICE
        ;;
  status)
	svstat /etc/service/$SERVICE
        ;;
  reload)
	# most daemons take HUP for reload
	svc -h /etc/service/$SERVICE
        ;;
  *)
        echo "Usage: $SERVICE
{start|stop|restart|reload|status}" >&2
        exit 1
        ;;
esac
exit 0


Reply to: