[systemd-devel] Systemd killed processes of custom services instead of graceful shutdown

Kamal Rathi kr30april at gmail.com
Mon Jun 15 09:49:13 UTC 2020


>>.what about just remove "RemainAfterExit" and look again?
I have tried the above option by removing that option and also tried to
change it to oneshot and RemainAfterexit=yes and then tried it but the
issue still remains.

can you answer the question why you did put that option at all into the
unit file and why do you add random options to your units like
"After=syslog.target systemd-user-sessions.service system.slice"
 I have added above options so that my script will start after
filesystems,network and user sessions are online and should be stopped
before those all services so that custom service will be first at shutdown
or at least before user.slice killed

On Mon, Jun 15, 2020 at 4:01 AM Reindl Harald <h.reindl at thelounge.net>
wrote:

>
>
> Am 15.06.20 um 10:51 schrieb Kamal Rathi:
> > Thanks Reindl for the response, but from the man page of systemd.service
> > even oneshot is a kind of simple service as default is
> > RemainAfterExit=no for simple.
>
> simple:  long running processes
> oneshot: expected to completly exit
>
> this are completly different beasts and type simple has nothing to with
> "the service is simple"
>
> Behavior of oneshot is similar to simple; however, the service manager
> will consider the unit up after the main process exits. It will then
> start follow-up units. RemainAfterExit= is particularly useful for this
> type of service
>
> > But if we talk about the original problem that processes are killed even
> > if ordering of services is there, .
> > from what it seems that user.slice is killed before my services will
> > shut down processes gracefully.
> > I have tried also putting user.slice as After= dependency but result is
> > the same.
>
> what about just remove "RemainAfterExit" and look again?
>
> can you answer the question why you did put that option at all into the
> unit file and why do you add random options to your units like
> "After=syslog.target systemd-user-sessions.service system.slice"
>
> > On Mon, Jun 15, 2020 at 3:18 AM Reindl Harald <h.reindl at thelounge.net
> > <mailto:h.reindl at thelounge.net>> wrote:
> >
> >
> >
> >     Am 15.06.20 um 10:01 schrieb Kamal Rathi:
> >     > Hi Team,
> >     >
> >     > I have two services which are dependent on each other and are
> working
> >     > fine at boot up but at shutdown / reboot , the processes get
> killed as
> >     > shutdown got initated.
> >     >
> >     > Services are running fine in particular order but processes got
> killed
> >     > .I have enabled lingering on both users and changed
> confgiuration in
> >     > logind.conf to KillUserProcesses=no but still issue is same
> >     >
> >     > let me know if my configuration is faulty or what I have missed so
> >     that
> >     > shutdown should be graceful for services and processes will be
> >     > shutdown with systemd custom service?
> >     >
> >     > I want first rdbms.service should be called and get process stopped
> >     > before grid.services (it seems systemd are killing user.slices
> >     > processes) and in startup-inverse should be followed .
> >     > Please help
> >
> >     i would start with thinking about why the useless
> "RemainAfterExit=yes"
> >     is in a service with type=simple
> >
> >     this is nice fot type=oneshot but makes no sense here when you want
> to
> >     order things running long living processes
> >
> >     RemainAfterExit=
> >     Takes a boolean value that specifies whether the service shall be
> >     considered active even when all its processes exited. Defaults to no.
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20200615/69eed116/attachment-0001.htm>


More information about the systemd-devel mailing list