Skip to content

Instantly share code, notes, and snippets.

@JaSei
Last active December 26, 2015 22:29
Show Gist options
  • Save JaSei/7223946 to your computer and use it in GitHub Desktop.
Save JaSei/7223946 to your computer and use it in GitHub Desktop.
/etc/init.d/statsite on centos
#!/bin/sh
# chkconfig: 2345 95 20
# description: statsite daemon
# processname: statsite
. /etc/rc.d/init.d/functions
exec="/root/statsite/statsite-master/statsite"
pidfile="/var/run/statsite.pid"
CONFIG="/etc/statsite.conf"
start() {
echo -n $"Starting `basename $exec`: "
$exec -f $CONFIG
return $?
}
stop() {
echo -n $"Stopping `basename $exec`: "
killproc -p $pidfile `basename $exec`
retval=$?
echo
return $retval
}
rh_status() {
status $exec
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
$1
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
exit 2
esac
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment