6

I am having this problem: https://stackoverflow.com/questions/10939072/add-nginx-as-a-ubuntu-service-stop-and-reload-doesnt-work

I am trying to understand if my code to start nginx is point to the same PID file as my nginx.conf file.

How do I know what code runs when I type sudo service nginx start ?

1 Answer 1

10

The sudo part just starts the rest with root priviliges.

The manual pages for service say that

service SCRIPT COMMAND

executes a System V init script located in /etc/init.d/SCRIPT or, in case of the system using Upstart, an upstart job in /etc/init.

If you have both:

The existence of an upstart job of the same name as a script in /etc/init.d will cause the upstart job to take precedence over the init.d script.

The handling of COMMAND depends on whether an init script or an upstart job is invoked.

4
  • AFAIK system doesn't know anything about upstart, and diverting to upstart is done via a sourced script in the init script. Modern system is systemd aware though.
    – jordanm
    Mar 11, 2014 at 19:00
  • @jordanm why the reference to system the OP asks about service AFAIK and at least on my Ubuntu system it tries system V or upstart scripts.
    – Anthon
    Mar 11, 2014 at 19:06
  • sorry, I meant service. It tries upstart because of init_is_upstart() in /lib/lsb/init-functions.
    – jordanm
    Mar 11, 2014 at 19:54
  • @jordanm I was not aware of how upstart hooks into the service, just referring to what the man page for service describes (on Ubuntu 12.04).
    – Anthon
    Mar 11, 2014 at 20:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .