22 lines
378 B
Bash
Executable File
22 lines
378 B
Bash
Executable File
#! /bin/sh
|
|
|
|
set -eu
|
|
|
|
exec 2>&1
|
|
|
|
COMMAND=/usr/sbin/nginx
|
|
PID_FILE=/run/nginx/nginx.pid
|
|
|
|
# Create pid file's directory
|
|
install -d -o nginx -g nginx ${PID_FILE%/*}
|
|
|
|
# Check nginx command is executable or not
|
|
test -x ${COMMAND} || exit 0
|
|
|
|
# Test nginx configuration
|
|
${COMMAND} -t -q || exit 0
|
|
|
|
${COMMAND} -v
|
|
|
|
exec ${COMMAND} -c /etc/nginx/nginx.conf -g "pid $PID_FILE; daemon off;"
|