The invoke-rc.d
command is for sysv init scripts (as its manpage says), not Upstart or systemd. Nginx still has a sysv init script (look for init.d
in the filelist), which is probably why invoke-rc.d
works for it (or seems to, anyway).
Even though the Debian guides use invoke-rc.d
, on Ubuntu, prefer using the service
command. It is a wrapper script that can handle sysv init, Upstart and systemd files.
The systemd documentation recommends using service
too:
If your distribution removes SysV init scripts in favor of systemd
unit files typing /etc/init.d/foobar start
to start a service will
not work, since the script will not be available. Use the more correct
/sbin/service foobar start
instead, and your command will be
forwarded to systemd. Note that invoking the init script directly has
always been suboptimal since too much of the caller's execution
context (environment block, umask, resource limits, audit trails, ...)
ended up being inherited by the service, and invocation via
/sbin/service
used to clean this up at least partially. Invocation
via /sbin/service works on both SysV and systemd systems. Also, LSB
only standardizes invocation via /sbin/service
anyway. (Note that
some distributions ship both systemd unit files and SysV scripts for
the services. For these invoking the init scripts will work as
expected and the request be forwarded to systemd in any case.)
Of course, for Ubuntu, service
is located at /usr/sbin/service
.