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