Skip to content

Instantly share code, notes, and snippets.

@chilversc
Created March 22, 2011 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chilversc/882322 to your computer and use it in GitHub Desktop.
Save chilversc/882322 to your computer and use it in GitHub Desktop.
Gablarski init.d script
#!/bin/bash
#
# Init file for Gablarski
#
# chkconfig: 345 25 25
#
# pidfile: /var/run/gablarski.pid
# source function library
. /etc/rc.d/init.d/functions
RETVAL=0
LOCKFILE=/var/lock/subsys/gablarski
PIDFILE=/var/run/gablarski.pid
MONO=/opt/mono-2.8.1/bin/mono
GABLARSKI_DIR=/opt/gablarski
GABLARSKI=$GABLARSKI_DIR/Barrel.exe
start() {
echo -n $"Starting Gablarski: "
su gablarski -c "$MONO $GABLARSKI >/dev/null 2>&1 &" && success || failure
RETVAL=$?
[ $RETVAL -eq 0 ] && echo `pgrep -f "$MONO $GABLARSKI"` > $PIDFILE
echo
return $RETVAL
}
stop () {
echo -n $"Stopping Gablarski: "
killproc -p $PIDFILE
RETVAL=$?
echo
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
RETVAL=1
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment