diff options
Diffstat (limited to 'contrib/dropnroll-launcher')
-rwxr-xr-x | contrib/dropnroll-launcher | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/dropnroll-launcher b/contrib/dropnroll-launcher new file mode 100755 index 0000000..f0569f3 --- /dev/null +++ b/contrib/dropnroll-launcher @@ -0,0 +1,28 @@ +#! /bin/sh + +if [ -z "$1" ]; then + echo "Usage: $0 <instance name>" + 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 |