mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-06 22:07:19 +02:00
43 lines
942 B
Plaintext
43 lines
942 B
Plaintext
#!/sbin/openrc-run
|
|
|
|
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"
|
|
}
|