To install it, just create a file called /etc/init.d/CCcamd and paste in the script below. Make sure the config and binary variables at the top match your locations. I kept mine in the default spots /var/bin and /var/etc. Then install it using the command "chkconfig --add CCcamd"
You can then start, stop and restart the server using the redhat service command. For example: "service CCcamd restart" or just run the script directly with start, stop or restart switches.
###################################################
#!/bin/sh
# Uncomment the following to debug
#set -x
## CCcamd startup script
# chkconfig: 2345 11 30
# description: CCcamd 2.0.8 sysv startup script for redhat based distros
. /etc/rc.d/init.d/functions
CCCAM="/var/bin/CCcam_2.0.8"
CCCAM_CONFIG="/var/etc/CCcam.cfg"
LOCKFILE="/var/lock/subsys/CCcamd"
start() {
# Start CCcam server
echo -n "Starting CCcamd"
if [ -f $LOCKFILE ] ; then
echo
echo -ne "Lock file exists. Try a restart instead."
echo_failure ; echo
exit -1
fi
$CCCAM -C $CCCAM_CONFIG -f
touch $LOCKFILE
echo_success ; echo
}
stop() {
echo -n "Stopping CCcamd"
killproc $CCCAM
rm -f $LOCKFILE
echo_success ; echo
}
debug() {
echo -n "Starting CCcamd (Debug Mode)" ; echo
if [ -f $LOCKFILE ] ; then
echo
echo -ne "Lockfile exists. Restarting in debug mode"
sleep 2
killproc $CCCAM
rm -f $LOCKFILE
$CCCAM -C $CCCAM_CONFIG -f -d
echo_success ; echo
fi
$CCCAM -C $CCCAM_CONFIG -f -d
echo_success ; echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
debug)
debug
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
esac
exit
No comments:
Post a Comment