systemctl
is not like the good old init-scripts. According to its man
page and its source code, it supports the following commands that are like the init-script commands you are searching for:
start
Start (activate) one or more units specified on the command line.
stop
Stop (deactivate) one or more units specified on the command line.
reload
Asks all units listed on the command line to reload their configuration.
restart
Stop and then start one or more units specified on the command line. If the units are not running yet, they will be started.
try-restart
Stop and then start one or more units specified on the command line if the units are running. This does nothing if units are not running.
reload-or-restart
Reload one or more units if they support it. If not, stop and then start them instead. If the units are not running yet, they will be started.
try-reload-or-restart
Reload one or more units if they support it. If not, stop and then start them instead. This does nothing if the units are not running.
The following redundant aliases exist, mostly for legacy reasons:
Verb |
Aliases |
try-reload-or-restart |
reload-or-try-restart , condreload , force-reload |
try-restart |
condrestart |
stop |
condstop |
So the group of these commands comes down to start
, stop
and reload
. Since start
and stop
are necessary for most service types (and you normally know if a service does not support one of them), the only thing you could want to know about is if a given service supports reload
or not.
Most times, you want it to either reload or restart: use systemctl reload-or-restart nagios
then. To really find out what command (if any) is executed for reloading, you can look into its service file. This can usually be found in /lib/systemd/system/
or /usr/lib/systemd/system
and is named $SERVICENAME.service
(in your case nagios.service
). This file contains commands for starting, stopping and maybe reloading the service, namely ExecStart
, ExecStop
and ExecReload
. If you're interested in that, you could do a grep ExecReload /lib/systemd/system/nagios.service
to find out if a service supports reloading or not.
As @LucaRicci pointed out, more elaborate services can have a ReloadSignal
instead of the ExecReload
, which they will answer to via sd_notify to indicate success.
TL;DR
systemctl
essentially supports start
, stop
and reload
. To find out if a Service supports reloading, just try it. If you need to reload multiple services in a script or something, use reload-or-restart
, which reloads the service if it has an ExecReload
-command or ReloadSignal
stored, otherwise it restarts it.