Based on the content of the Ubuntu init.d script to control nginx instances, found at : http://wiki.nginx.org/Nginx-init-ubuntu I'm trying to update Upstart version, found at: http://wiki.nginx.org/Upstart to make the configuration syntax check.
Basically what it needs to do is, call:
$DAEMON -t -c $NGINX_CONF_FILE
This should output error messages regarding wrong syntax on configuration files.
I've tried the following without success:
# nginx
description "nginx http daemon"
author "George Shammas <georgyo@gmail.com>"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
env DAEMON=/opt/nginx/sbin/nginx
env PID=/var/run/nginx.pid
env NGINX_CONF_FILE=/etc/nginx/nginx.conf
console output
expect fork
respawn
pre-start script
$DAEMON -t -c $NGINX_CONF_FILE
if [ $? -ne 0 ]
then exit $?
fi
end script
post-stop script
start-stop-daemon --stop --pidfile $PID --name nginx --exec $DAEMON --signal TERM
end script
exec $DAEMON -c $NGINX_CONF_FILE
The problem here is that, it doesn't put the output to console, even with the "console output" stanza.
Am I missing something here?
What I get when it can't start is a simple:
root@localhost:/# start nginx
start: Job failed to start