[systemd-devel] killproc, pidofproc, ExecStop, ExecStart -advice please
grawity at gmail.com
Mon Feb 18 11:49:55 PST 2013
On Mon, Feb 18, 2013 at 9:28 PM, lux-integ <lux-integ at btconnect.com> wrote:
> I am new to this list and learning to write systemd service scripts. I would
> like to know if there are equivalents for the shell functions:-
> used heavily in init scripts and as described in linuxstandardbase (url below)
> If there are no such equivalents I would be gateful for guidance on the best
> way to stop daemons specifying their process_id and removing the said files
> when the daemon has stopped.
Usually you do not need such functions *at all* – systemd will
automatically find and kill the main process of your service. (They're
tracked using cgroups; you can see the processes of every service in
its `systemctl status`, or all services at once using `systemd-cgls`.)
For example, to start & stop the Racoon daemon, only these three lines
If the service writes a pidfile, you can tell systemd to use that with
the PIDFile= option.
> Also advice would be appreciated on whether in such scripts implementing
> is the recommended way to restart daemons or whether/if there are generic
> 'systemd' ways to restart daemons.
The recommended way is to use `systemctl restart` (which simply stops
the daemon and starts it again).
More information about the systemd-devel