LSB compliant init script (e.g. Debian 7)

Maxim Dounin mdounin at
Fri Jan 3 04:18:17 UTC 2014


On Tue, Dec 31, 2013 at 01:35:52PM +0100, Richard Fussenegger, BSc wrote:

> I also happen to have a LSB compliant init script for nginx. I think some
> lines should be removed for inclusion in the nginx source (everything that
> has to do with the temporary paths), but it's a rock solid starting point.

There are collection of various init scripts here on wiki:

> The script allows you to use "service nginx
> {force-reload|reload|restart|start|status|stop}" and "nginx -t" is always
> executed before attempting to do anything. This ensures that the service
> isn't interrupted because of some misconfiguration. It's also using the
> various LSB functions for some eye candy.

Just a side note: nginx reload is a correct way to avoid service 
interruptions, as it doesn't apply a configuration if there are 
problems.  On the other hand, "nginx -t" may produce incorrect results if 
nginx binary in memory doesn't match one on disk (e.g., in the 
process of upgrade), and forcing "nginx -t" would be a wrong thing 
to do.  Note well that in some cases (e.g., before start or stop) 
calling "nginx -t" is useless would be a plain waste of resources.

Maxim Dounin

More information about the nginx-devel mailing list