On Mon, Feb 18, 2013 at 9:28 PM, lux-integ <lux-in...@btconnect.com> wrote: > Greetings, > > 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:- > > killproc() > pidofproc() > > used heavily in init scripts and as described in linuxstandardbase (url below) > http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core- > generic/iniscrptfunc.html > > 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 are needed: [Service] Type=forking ExecStart=/usr/sbin/racoon 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 > ExecStop= > then > ExecStart= > > 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). -- Mantas Mikulėnas _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel