Skip to content
Snippets Groups Projects
Commit a9dc2f84 authored by ale's avatar ale
Browse files

create the /var/run/nginx directory on start

parent 1efab69e
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ DAEMON=/usr/sbin/nginx-log-peeker ...@@ -19,6 +19,7 @@ DAEMON=/usr/sbin/nginx-log-peeker
DAEMON_ARGS="" DAEMON_ARGS=""
PIDFILE=/var/run/$NAME.pid PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME SCRIPTNAME=/etc/init.d/$NAME
USER=www-data
# Exit if the package is not installed # Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0 [ -x "$DAEMON" ] || exit 0
...@@ -39,6 +40,12 @@ SCRIPTNAME=/etc/init.d/$NAME ...@@ -39,6 +40,12 @@ SCRIPTNAME=/etc/init.d/$NAME
# #
do_start() do_start()
{ {
# Ensure that the /var/run/nginx directory exists.
if [ ! -d /var/run/nginx ]; then
mkdir /var/run/nginx
fi
chown $USER /var/run/nginx
# Return # Return
# 0 if daemon has been started # 0 if daemon has been started
# 1 if daemon was already running # 1 if daemon was already running
...@@ -46,7 +53,7 @@ do_start() ...@@ -46,7 +53,7 @@ do_start()
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1 || return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE \ start-stop-daemon --start --quiet --pidfile $PIDFILE \
--make-pidfile --background --exec $DAEMON -- \ --chuid $USER --make-pidfile --background --exec $DAEMON -- \
$DAEMON_ARGS \ $DAEMON_ARGS \
|| return 2 || return 2
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment