Upstart conf for managing nginx

Hello,
I wrote a small upstart script to stop/start nginx through upstart. This
is
how it looks

description “nginx http daemon”
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
expect deamon
respawn
respawn limit 10 5
chdir /usr/local/nginx
exec ./nginx

I am running nginx from “/usr/local/nginx”, and running as a user with
super user.

Still it hangs on start/stop command. Any idea what I may be missing…
Thanks,
Vikrant

On Fri, Jul 24, 2015 at 04:09:02PM -0700, vikrant singh wrote:

Hi there,

I wrote a small upstart script to stop/start nginx through upstart. This is
how it looks

I do not have an upstart system to test on, but:

  • comparing with Ubuntu Upstart | NGINX, you have “expect daemon”
    and that has “expect fork”.

  • the binary you run is /usr/local/nginx/nginx; I think it is more
    common
    for it to be /usr/local/nginx/sbin/nginx.

Does checking and changing either of those make a difference?

Does “hangs” mean “things run fine eventually, but there is a delay”;
or “things never run correctly”?

(Is there anything in the nginx or upstart logs which might indicate
the problem?)

f

Francis D. [email protected]

Besides everything Francis said, there is also a typo in the ‘expect’
line. s/deamon/daemon


Thiago F.

Thanks for your reply… and pointing out the typo.
nginx doesnt comes up, and upstart command hangs, I have to kill it to
come
out of it.
Changing path did not helped and neither does expect fork (but I do
agree I
need fork and not daemon) .

It turned out that I named my conf file as “nginx.conf”, and it was
causing
the problem. I guess because it is also trying to start a binary with
same
name (but not sure).
Changing the name of config file fixed the issue… and I am able to use
upstart conf to manage nginx.