diff options
author | Timo Teräs <timo.teras@iki.fi> | 2014-05-07 09:44:55 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2014-05-07 09:45:35 +0300 |
commit | 9893cf0f44ca86d40f46e3b0b4306b42bb5041ac (patch) | |
tree | 55b3063b4062844cae66dadcb8d79b38ce3f425f /main/nginx-lua/nginx.initd | |
parent | b8cb931e312b5590897c310b0e3bc3f90d6ef809 (diff) | |
download | aports-9893cf0f44ca86d40f46e3b0b4306b42bb5041ac.tar.bz2 aports-9893cf0f44ca86d40f46e3b0b4306b42bb5041ac.tar.xz |
main/nginx-lua: moved from testing
Diffstat (limited to 'main/nginx-lua/nginx.initd')
-rwxr-xr-x | main/nginx-lua/nginx.initd | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/main/nginx-lua/nginx.initd b/main/nginx-lua/nginx.initd new file mode 100755 index 0000000000..ce2b7b8bb9 --- /dev/null +++ b/main/nginx-lua/nginx.initd @@ -0,0 +1,42 @@ +#!/sbin/runscript + +extra_started_commands="reload" +extra_commands="configtest" + +depend() { + need net + use dns logger netmount +} + +CONFFILE=${CONFFILE:-/etc/nginx/${SVCNAME}.conf} +PIDFILE=${PIDFILE:-/var/run/${SVCNAME}.pid} + +configtest() { + ebegin "Checking ${SVCNAME} configuration" + mkdir -p /tmp/nginx + /usr/sbin/nginx -c ${CONFFILE} -t + eend $? "failed, please correct errors above" +} + +start() { + configtest || return 1 + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --pidfile "${PIDFILE}" \ + --exec /usr/sbin/nginx -- -c ${CONFFILE} -g "pid ${PIDFILE};" + eend $? "Failed to start ${SVCNAME}" +} + +stop() { + configtest || return 1 + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --pidfile "${PIDFILE}" + eend $? "Failed to stop ${SVCNAME}" + rm -f "${PIDFILE}" +} + +reload() { + configtest || return 1 + ebegin "Refreshing ${SVCNAME} configuration" + kill -HUP $(cat "${PIDFILE}") &>/dev/null + eend $? "Failed to reload nginx" +} |