Created
August 4, 2017 10:44
-
-
Save pperehozhih/c312672ce1ed8ea081e5f1c24557382a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# Must be a valid filename | |
NAME=nginx | |
PIDFILE=./obj/$NAME.pid | |
#This is the command to be run, give the full pathname | |
DAEMON=./obj/nginx | |
case "$1" in | |
start) | |
echo -n "Starting daemon: "$NAME | |
$DAEMON -t -c ./conf/nginx.conf -p "" -g "pid ${PIDFILE};" | |
echo "." | |
;; | |
stop) | |
echo -n "Stopping daemon: "$NAME | |
kill -QUIT $( cat ${PIDFILE} ) | |
echo "." | |
;; | |
restart) | |
echo -n "Restarting daemon: "$NAME | |
kill -QUIT $( cat ${PIDFILE} ) | |
$DAEMON -t -c ./conf/nginx.conf -p "" -g "pid ${PIDFILE};" | |
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