Skip to content

Instantly share code, notes, and snippets.

@mactkg
Created November 19, 2011 17:25
Show Gist options
  • Save mactkg/1379089 to your computer and use it in GitHub Desktop.
Save mactkg/1379089 to your computer and use it in GitHub Desktop.
#!/bin/sh
# /etc/init.d/tiarra
NAME=tiarra
USER=aereal
PROG=/usr/local/src/tiarra/tiarra
PIDFILE=/var/run/$NAME.pid
start() {
echo -n "Starting: $NAME"
start-stop-daemon \
--start \
--pidfile $PIDFILE \
--make-pidfile \
--background \
--exec $PROG \
--user $USER \
--chuid $USER \
--chdir /home/$USER \
-- \
--config=/home/$USER/tiarra.conf
return $?
}
stop() {
echo -n "Stopping: $NAME"
start-stop-daemon \
--stop \
--oknodo \
--pidfile $PIDFILE
return $?
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment