Just checked my files against your above and all seems OK to me.
# start the control daemon
start_ccd() {
if [ $HAS_CCD -gt 0 ]; then
echo -n "cc-control "
if [ -f $HOMEPATH/var/run/cc-control.pid ]; then
CCDPID=$(cat $HOMEPATH/var/run/cc-control.pid)
[ ! -z "$CCDPID" -a -d "/proc/$CCDPID" ] && echo -n "(already running) " && return 0
rm -f $HOMEPATH/var/run/cc-control.pid
fi
RPC_PORT=""
RPC_MIN_WORKERS=3
RPC_MAX_WORKERS=15
. $HOMEPATH/etc/cc-control.conf
[ -z "$RPC_PORT" ] && echo "$HOMEPATH/etc/cc-control.conf is missing or damaged, cannot start cc-control" && return 1
LICENSE_KEY=""
. $HOMEPATH/etc/license.conf
[ -z "$LICENSE_KEY" ] && echo "$HOMEPATH/etc/license.conf is missing or damaged, cannot start cc-control" && return 1
# if this server is running the Centova Cast web interface, we must disable the RPC server's web interface
# [ $HAS_WEB -gt 0 ] && WEB_PORT=0
if [ "$RPC_CHROOT" == "0" ]; then
NOCHROOT="-o"
else
NOCHROOT=""
fi
DEBUGPREFIX=""
DEBUGARGS=""
if [ "$1" == "gdb" ]; then
DEBUGARGS="-f -z -vvvvv"
DEBUGPREFIX="gdb --args"
elif [ "$1" == "debug" ]; then
DEBUGARGS="-f -vvvvv"
elif [ "$1" == "strace" ]; then
DEBUGARGS="-f -vvvvv"
DEBUGPREFIX="strace"
elif [ "$1" == "fg" ]; then
DEBUGARGS="-f"
fi
$DEBUGPREFIX $HOMEPATH/sbin/cc-control \
-p $RPC_PORT -b $RPC_ADDR -c $RPC_CONN_LIMIT -w $RPC_MIN_WORKERS -x $RPC_MAX_WORKERS -u ccuser -g ccuser \
-r $HOMEPATH \
-m /var/log/control/master.log \
-l $LICENSE_KEY \
-s /var/run/cc-control.pid $NOCHROOT $DEBUGARGS
[ $? -gt 0 ] && echo "- failed" && return 1
fi
return 0
}
# stop the control daemon
stop_ccd() {
if [ $HAS_CCD -gt 0 ]; then
echo -n "cc-control "
if [ -f $HOMEPATH/var/run/cc-control.pid ]; then
kill $(cat $HOMEPATH/var/run/cc-control.pid)
rm -f $HOMEPATH/var/run/cc-control.pid
else
echo -n "(not running) "
fi
fi
return 0
}
# start the web interface daemon
start_web() {
if [ $HAS_WEB -gt 0 ]; then
echo -n "cc-web "
if [ -f $HOMEPATH/var/run/cc-web.pid ]; then
WEBPID=$(cat $HOMEPATH/var/run/cc-web.pid)
[ ! -z "$WEBPID" -a -d "/proc/$WEBPID" ] && echo -n "(already running) " && return 0
rm -f $HOMEPATH/var/run/cc-web.pid
fi
$HOMEPATH/sbin/cc-web
[ $? -gt 0 ] && echo "- failed" && return 1
fi
return 0
}
# stop the web interface daemon
stop_web() {
if [ $HAS_WEB -gt 0 ]; then
echo -n "cc-web "
if [ -f $HOMEPATH/var/run/cc-web.pid ]; then
kill $(cat $HOMEPATH/var/run/cc-web.pid)
rm -f $HOMEPATH/var/run/cc-web.pid
else
echo -n "(not running) "
fi
fi
return 0
}
# start the application server daemon
start_app() {
if [ $HAS_APP -gt 0 ]; then
echo -n "cc-appserver "
cat <<- "EOF" | $HOMEPATH/lib/cc-int -- $HOMEPATH/etc/centovacast.conf > $HOMEPATH/system/autoconfig.php
<?php echo '<'."?php // auto-generated from $HOMEPATH/etc/centovacast.conf -- DO NOT EDIT\n".preg_replace(
array('/^\#.*?$/m','/=true/i','/=false/i','/\n+/','/^([A-Z0-9_]+)=([0-9]+)$/m','/^([A-Z0-9_]+)=\'?(.*?)\'?\s*$/m'),
array("",'=1','=0',"\n",'define(\'$1\',$2);','define(\'$1\',\'$2\');'),
file_get_contents($_SERVER['argv'][1]));?>
EOF
chmod 0640 $HOMEPATH/system/autoconfig.php
chown centovacast.centovacast $HOMEPATH/system/autoconfig.php
if [ -f $HOMEPATH/var/run/cc-appserver.pid ]; then
APPPID=$(cat $HOMEPATH/var/run/cc-appserver.pid)
[ ! -z "$APPPID" -a -d "/proc/$APPPID" ] && echo -n "(already running) " && return 0
rm -f $HOMEPATH/var/run/cc-appserver.pid
fi
$HOMEPATH/sbin/clear_web_cache >/dev/null 2>&1
$HOMEPATH/sbin/cc-appserver
[ $? -gt 0 ] && echo "- failed" && return 1
fi
return 0
}
# stop the application server daemon
stop_app() {
QUIET="$1"
if [ $HAS_APP -gt 0 ]; then
[ -z "$QUIET" ] && echo -n "cc-appserver "
if [ -f $HOMEPATH/var/run/cc-appserver.pid ]; then
kill $(cat $HOMEPATH/var/run/cc-appserver.pid)
rm -f $HOMEPATH/var/run/cc-appserver.pid
else
[ -z "$QUIET" ] && echo -n "(not running) "
fi
fi
return 0
}