[Bug 1494183] [NEW] nginx/1.4.6 on 14.04 LTS x86_64, init.d script does not have proper error handling
Radoslav Stefanov
radoslav at rstefanov.info
Thu Sep 10 08:36:55 UTC 2015
Public bug reported:
If for some reason Nginx can not start, the init.d script does not
detect a problem.
=============================================================
root at vm-web1-qa4:~# su web
web at vm-web1-qa4:/root$ service nginx start
web at vm-web1-qa4:/root$ echo $?
0
web at vm-web1-qa4:/root$ ps aux | grep -v grep | grep nginx
=============================================================
Bellow I have removed /dev/null redirect to make it a bit noisy (why redirect to /dev/null in the first place?)
=============================================================
root at vm-web1-qa4:~# service nginx start
nginx: [emerg] open() "/var/log/nginx/domain.com/access.log" failed (2: No such file or directory)
root at vm-web1-qa4:~# echo $?
0
=============================================================
=============================================================
root at vm-web1-qa4:~# /etc/init.d/nginx start
nginx: [emerg] open() "/var/log/nginx/domain.com/access.log" failed (2: No such file or directory)
root at vm-web1-qa4:~# echo $?
0
=============================================================
In the example above I have moved /var/log/domain.com directory to
/var/log/domain.com.bk directory [ to break Nginx ] and the init.d
script does not report any error. Instead it just returns 0 for success.
This breaks a lot of scripts that depend on return codes. When there is
a problem and Nginx has not started for whatever reason, the
/etc/init.d/nginx should be able to detect it and print appropriate
error code.
Ubuntu 14.04 LTS 64 bit
Nginx 1.4.6
** Affects: nginx (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to nginx in Ubuntu.
https://bugs.launchpad.net/bugs/1494183
Title:
nginx/1.4.6 on 14.04 LTS x86_64, init.d script does not have proper
error handling
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1494183/+subscriptions
More information about the Ubuntu-server-bugs
mailing list