Created
December 20, 2011 10:50
-
-
Save Koc/1501185 to your computer and use it in GitHub Desktop.
start-stop-daemon php example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh | |
set -e | |
NAME="brouzie-php-53" | |
RUN_AS_USER=brouzie | |
DAEMON=/opt/php/5.3.8/bin/php-cgi | |
DAEMON_OPTS="-b /home/brouzie/php/5.3.8.sock" | |
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" | |
case "$1" in | |
start) | |
echo -n "Starting daemon: "$NAME | |
start-stop-daemon --start --quiet --chuid $RUN_AS_USER --exec $DAEMON -- $DAEMON_OPTS & | |
echo "." | |
;; | |
stop) | |
echo -n "Stopping daemon: "$NAME | |
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON -- $DAEMON_OPTS | |
echo "." | |
;; | |
restart) | |
echo -n "Restarting daemon: "$NAME | |
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON -- $DAEMON_OPTS --retry 30 | |
start-stop-daemon --start --quiet --chuid $RUN_AS_USER --exec $DAEMON -- $DAEMON_OPTS & | |
echo "." | |
;; | |
*) | |
echo "Usage: "$1" {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