#!/bin/sh
# Starts up the warden service
######################################################################

PATH="${PATH}:/usr/local/bin:/usr/local/sbin"
export PATH

# Source our functions
PROGDIR="${1}"

if [ -z "${PROGDIR}" ]
then
   echo "PROGDIR unset! Is The Warden installed properly?"
   exit 155
fi

# Source our variables
. ${PROGDIR}/conf/warden.conf

echo "Starting the Warden"

cd ${JDIR}
for i in `ls -d *`
do
  if [ -e "${i}/etc/.wardenautostart" ]
  then
   echo -e "Starting Jail (${i})...\c"
   ${PROGDIR}/scripts/backend/startjail.sh "${i}" >/dev/null 2>/dev/null
   echo "Done"
  fi
done
