Skip to content

Instantly share code, notes, and snippets.

@zakjan
Last active August 29, 2015 14:25
Show Gist options
  • Save zakjan/1f1de11c51bfce1fd0ca to your computer and use it in GitHub Desktop.
Save zakjan/1f1de11c51bfce1fd0ca to your computer and use it in GitHub Desktop.
PHPCI init script
#!/bin/sh
NAME=phpci
PIDFILE=/var/run/${NAME}.pid
DAEMON=/home/www/ci.d.cdn77.com/subdomains/www/phpci/daemonise
DAEMON_OPTS=phpci:daemonise
do_start() {
echo -n "Starting daemon $NAME... "
start-stop-daemon --start --make-pidfile --pidfile $PIDFILE --background --exec $DAEMON -- $DAEMON_OPTS
echo "done"
}
do_stop() {
echo -n "Stopping daemon $NAME... "
start-stop-daemon --stop --oknodo --pidfile $PIDFILE
echo "done"
}
do_restart() {
do_stop
do_start
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart)
do_restart
;;
*)
echo "Usage: $(basename $0) {start|stop|restart}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment