#! /bin/sh if [ -z "$1" ]; then echo "Usage: $0 " exit 1 fi INST="$1" NAME=dropnroll CONFIG_DIR="/etc/$NAME" VARRUN_DIR=/var/run/$NAME if [ -d "$CONFIG_DIR/$INST/" ] && [ -e "$CONFIG_DIR/$INST/config" ]; then NEWFILE='' test -f $CONFIG_DIR/$INST/newfile.sh && NEWFILE="-x $CONFIG_DIR/$INST/newfile.sh" CHROOTDIR=`grep '^chroot' < $CONFIG_DIR/$INST/config | sed 's/chroot\s*//'` if [ -n "$CHROOTDIR" ] ; then test -d $CHROOTDIR || mkdir -p $CHROOTDIR fi test -d $VARRUN_DIR || mkdir -p $VARRUN_DIR DAEMONARG=`sed 's/#.*//' < $CONFIG_DIR/$INST/config | grep -e '\w' | sed 's/^/--/' | tr '\n' ' '` exec dropnroll -D --write-pid $VARRUN_DIR/$INST.pid $NEWFILE $DAEMONARG else echo "Instance config directory does not exist or does not contain a config file" exit 1 fi exit 1 # should not be reached unless exec returns because of an error