On Sat, Dec 1, 2012 at 4:20 PM,  <[email protected]> wrote:
> How does systemd kill the running processes at shutdown?

On Sat, Dec 1, 2012 at 6:59 PM, Reindl Harald <[email protected]> wrote:
>
> Am 01.12.2012 16:20, schrieb [email protected]:
>> How does systemd kill the running processes at shutdown?
>> (I tried asking at fedoraforum.org first, but got no responses there.)
>>
>> Presumably it tries to gracefully stop all services. Is every process part 
>> of a service?
>
> finally each process get a SIGTERM and any proper written process
> wil cleanup anything he has to do and quit gracefully, this is the
> way unix works

For details about how remaining processes in a service is killed see
systemd.kill(5) [0].

Any processes still alive after all services have been terminated are
killed (in a loop) with SIGTERM/SIGKILL by systemd-shutdown [1](at
the same time remaining devices/filesystems are unmounted and
disassembled).

If your initramfs supports it [2], systemd will then pivot away from
your root partition, back into your initramfs which will again try to
kill remaining processes and unomunt remaining filesystems.

Then we give up \o/

> Presumably it tries to gracefully stop all services. Is every process part of 
> a service?

Not necessarily (but you need to make an effort to create an exception).

> When it stops a service, it presumably runs the ExecStop of that service, but 
> what if the service doesn't exit immediately? How long does systemd wait?

See systemd.service(5) [3], in particular TimeoutStopSec=.

HTH,

Tom

[0]: <http://www.freedesktop.org/software/systemd/man/systemd.kill.html>
[1]: <http://cgit.freedesktop.org/systemd/systemd/tree/src/core/shutdown.c>
[2]: <http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface>
[3]: <http://www.freedesktop.org/software/systemd/man/systemd.service.html>
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to