<div dir="ltr"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>The fact that you need RemainAfterExit at all hints that processes that</div><div>belong to your service are not running as part of service control group.</div><div>Knowing how Oracle has traditionally been managed, I suspect that you</div><div>perform "su - oracle_owner" or similar to start them in which case all</div><div>actual service processes become part of respective user sessions, and</div><div>not part of your system services. There is no way to synchronize</div><div>stopping of processes/services belonging to different users. They are</div><div>completely independent and shutdown for all sessions is initiated in</div><div>parallel.</div><div><br></div><div>If my theory is correct, the fix would be to actually run your systemd</div><div>services as systemd services. If my theory is wrong, provide full from</div><div>system boot to shutdown where it could be seen how your services are</div><div>started/stopped. Enabling systemd debug log level when doing it</div><div>certainly won't harm. </div></blockquote><div><br></div><div><br></div>I have incorporated Type=oneshot and remainAfterExit=yes as it was helpful in startup of services, but still grid.service are starting up in user.slice and shutdown was giving the same results<div>I am attaching debug logs .</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 15, 2020 at 10:34 AM Andrei Borzenkov <<a href="mailto:arvidjaar@gmail.com">arvidjaar@gmail.com</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">15.06.2020 11:01, Kamal Rathi пишет:<br>
> Hi Team,<br>
> <br>
> I have two services which are dependent on each other and are working fine<br>
> at boot up but at shutdown / reboot , the processes get killed as shutdown<br>
> got initated.<br>
> <br>
> Services are running fine in particular order but processes got killed .I<br>
> have enabled lingering on both users and changed confgiuration in<br>
> logind.conf to KillUserProcesses=no but still issue is same<br>
> <br>
<br>
Lingering/KillUserProcesses are relevant only for user services/sessions<br>
and so far there was no indication you use either.<br>
<br>
> ##############<br>
> Systemd service files content are below<br>
> <br>
> cat /etc/systemd/system/grid.service<br>
> [Unit]<br>
> Description=Service to auto start Oracle ASM application<br>
> Before=rdbms.service<br>
> After=syslog.target network.target nfs-mountd.service autofs.service<br>
> systemd-user-sessions.service system.slice<br>
> [Service]<br>
> Type=simple<br>
> TimeoutSec=5min<br>
> User=grid<br>
> Group=dba<br>
> ExecStart=/opt/admin/bin/asm<br>
> ExecStop=/opt/admin/bin/asm_stop<br>
> RemainAfterExit=yes<br>
> [Install]<br>
> WantedBy=multi-user.target<br>
> <br>
> <br>
> <br>
> cat /etc/systemd/system/rdbms.service<br>
> [Unit]<br>
> Description=Service to auto start Oracle RDBMS application<br>
> Requires=grid.service<br>
> After=grid.service syslog.target network.target nfs-mountd.service<br>
> autofs.service systemd-user-sessions.service system.slice<br>
> [Service]<br>
> Type=simple<br>
> TimeoutSec=5min<br>
> User=osarahn9<br>
> Group=dba<br>
> ExecStart=/opt/admin/bin/rdbms<br>
> ExecStop=/opt/admin/bin/rdbms_stop<br>
> RemainAfterExit=yes<br>
> [Install]<br>
> WantedBy=multi-user.target grid.service<br>
> <br>
> <br>
> let me know if my configuration is faulty or what I have missed so that<br>
> shutdown should be graceful for services and processes will be<br>
> shutdown with systemd custom service?<br>
> <br>
<br>
You do not provide enough information (full logs would be certainly much<br>
more useful than long description) so I can only give educated guess.<br>
<br>
> I want first rdbms.service should be called and get process stopped before<br>
> grid.services (it seems systemd are killing user.slices processes) and in<br>
> startup-inverse should be followed .<br>
> Please help .<br>
> <br>
<br>
The fact that you need RemainAfterExit at all hints that processes that<br>
belong to your service are not running as part of service control group.<br>
Knowing how Oracle has traditionally been managed, I suspect that you<br>
perform "su - oracle_owner" or similar to start them in which case all<br>
actual service processes become part of respective user sessions, and<br>
not part of your system services. There is no way to synchronize<br>
stopping of processes/services belonging to different users. They are<br>
completely independent and shutdown for all sessions is initiated in<br>
parallel.<br>
<br>
If my theory is correct, the fix would be to actually run your systemd<br>
services as systemd services. If my theory is wrong, provide full from<br>
system boot to shutdown where it could be seen how your services are<br>
started/stopped. Enabling systemd debug log level when doing it<br>
certainly won't harm.<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>