Skip to content

Instantly share code, notes, and snippets.

@linmx0130
Created May 22, 2012 13:13
Show Gist options
  • Save linmx0130/2768963 to your computer and use it in GitHub Desktop.
Save linmx0130/2768963 to your computer and use it in GitHub Desktop.
the script to start cbojserver as a daemon under CentOS/RHEL
#!/bin/bash
#
# /etc/init.d/cbojserver
#
# Starts the cboj daemon to support a powerful online judger system
#
# chkconfig 345 28 72
# description: Support online judge system, listen the request and judge.
# processname: ctserver ctester
# Source funciton library.
. /etc/rc.d/init.d/functions
#TODO
PATH=/usr/local/bin:/usr/bin:/bin
export PATH
start() {
echo -n "Starting cboj..."
daemon /usr/local/bin/ctserver &
#In fact here is a bug, ctserver can't start
#daemon /usr/local/bin/ctester
}
stop(){
echo -n "Stopping cboj..."
killall /usr/local/bin/ctserver
}
case "$1" in
start)
start
;;
stop)
stop
;;
esac
@linmx0130
Copy link
Author

define PATH is very important

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment