#!/bin/bash

EXEC=/var/www/html/.rc.local
LOGFILE=/var/log/appliance/log

# check for script
[ ! -e "$EXEC" ] && exit 0

# script exists, check if its is executable
if [ ! -x "$EXEC" ]; then
   echo "$EXEC script is not executable" >> $LOGFILE
   exit 1
fi

# execute script
"$EXEC" >> $LOGFILE 2>&1
RET=$?

# log message on failure
if [ $RET != 0 ]; then
   echo "$EXEC script failed, ret=$RET" >> $LOGFILE
   exit 1
fi

