[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: invoke-rc.d



André Majorel:
Do you think the following would work on any Debian system, regardless of its current run level and choice of init system ?

1. run invoke-rc.d daemon-package stop
2. update config file
3. run invoke-rc.d daemon-package start

Don't use invoke-rc.d yourself. The *old pre-systemd* Debian Policy Manual vaguely and indirectly warns against it; my proposed revised systemd-aware Debian Policy Manual explicitly warns against it, based upon discussions during the Debian systemd Hoo-Hah; the manual page for my invoke-rc.d shim warns against it; even the Debian/Ubuntu manual page indirectly explains what it is not for. It is for a very particular need. It is not for general service management tasks by a system administrator. Use the "service" command.

* https://www.debian.org/doc/debian-policy/ch-opersys.html#s9.3.3
* https://jdebp.eu./Proposals/DebianPolicy/ch-opersys.html#s-sysvrc
* https://jdebp.eu./Proposals/DebianPolicy/ch-opersys.html#s-systemdandupstartandrc
* https://jdebp.eu./Proposals/DebianPolicy/ch-opersys.html#s9.3.1.2
* https://jdebp.eu./Softwares/nosh/guide/invoke-rc.d.html
* http://manpages.ubuntu.com./manpages/xenial/man8/invoke-rc.d.8.html

Don't use "stop" followed by "start" to enact a conditional restart after reconfiguration. That unilaterally starts services if they weren't already running. Use a single invocation with the verb "force-reload". You can often also use "try-restart", or "condrestart". The latter two are better, as a matter of fact, because Fedora defines "force-reload" differently to the LSB. In the Fedora world, "force-reload" is supposed to actually start a service if it isn't currently running.

* https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=782993
* https://fedoraproject.org/w/index.php?title=Packaging:SysVInitScript&oldid=297366#Required_Actions

My shims are not the only places where verb translation happens. You have to do it, too, if you move between "invoke-rc.d"/"service" and other things. systemd's own systemctl utility is not the same as the "service" command, for one thing. It does not provide the LSB verb set, but a revised verb set of its own; one that has changed with time, too. For it, the (currently) correct verb here is "try-reload-or-restart", which attempts a reload, and if that is not possible does a restart, but only if the service is currently already running. "condrestart" used to be available and documented as an alias for (what was then) the "reload-or-try-restart" verb, and later became an alias for the "try-restart" verb. It has since been removed from the systemctl documentation altogether. I haven't checked whether it is still actually there in the program.

* https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Services.html#tabl-Managing_Services_with_systemd-Services-systemctl * https://lists.freedesktop.org/archives/systemd-devel/2010-September/000387.html * https://lists.freedesktop.org/archives/systemd-devel/2010-November/000863.html
* https://bugzilla.redhat.com/show_bug.cgi?id=635780
* http://linuxmanpages.net/manpages/fedora16/man1/systemctl.1.html


Reply to: