#!/bin/sh # usage: $0 name_of_configuration # This script shall be used to put ldirectord under # control of daemontools. This is safer than System V # init-script since ldirectord is restarted by supervise # after a crash. Note that in the configuration file this # must be specified with the 'supervise' directive to leave # ldirectord in foreground. The logfiles will be handled by # supervise too. # See http://untroubled.org/rpms/daemontools/ or # http://cr.yp.to/daemontools.html for details. [ "$1" = "" ] && echo "usage: $0 name_of_configuration" && exit 1 POSTFIX=$1 SVCDIR=/var/ldirectord.$POSTFIX mkdir $SVCDIR mkdir $SVCDIR/env mkdir $SVCDIR/log mkdir $SVCDIR/log/main touch $SVCDIR/log/status cat << EOF_run > $SVCDIR/run #!/bin/sh exec 2>&1 exec envdir ./env softlimit -d250000 /usr/sbin/ldirectord $POSTFIX start EOF_run chmod +t $SVCDIR chmod 755 $SVCDIR/run cat << EOF_logrun > $SVCDIR/log/run #!/bin/sh exec setuidgid nobody multilog ./main EOF_logrun chown nobody.nobody $SVCDIR/log/main chmod g+s $SVCDIR/log/main chmod 755 $SVCDIR/log/run chown nobody.nobody $SVCDIR/log/status ln -s $SVCDIR /etc/svscan/