Re: [EXTERNAL] Re: ExecStop doesn't get called when service crashes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Reindal,

Apologies if I the subject is misleading.

I meant that when the main process in the service gets crashed, ExecStop doesn't get invoked. In the below example, I am killing the main process 'CcspCrSsp' and expect the path '/tmp/CcspCrSsp_Restarted' to be created. However, it is not getting created. Please let me know if my expectation is correct or ExecStopPost is the right way to handle it.

● CcspCrSsp.service - CcspCrSsp service
     Loaded: loaded (/lib/systemd/system/CcspCrSsp.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2020-06-07 22:19:32 UTC; 1 day 12h ago
    Process: 2621 ExecStartPre=/bin/sh -c mkdir -p /rdklogs/logs/ (code=exited, status=0/SUCCESS)
    Process: 2667 ExecStartPre=/bin/sh -c (/usr/ccsp/ccspSysConfigEarly.sh) (code=exited, status=0/SUCCESS)
    Process: 2757 ExecStart=/usr/bin/CcspCrSsp -subsys $Subsys (code=exited, status=0/SUCCESS)
   Main PID: 2767 (CcspCrSsp)
     CGroup: /system.slice/CcspCrSsp.service
             └─2767 /usr/bin/CcspCrSsp -subsys eRT.

root@Docsis-Gateway:~# kill -11 2767
root@Docsis-Gateway:~#
root@Docsis-Gateway:~# ls -la /tmp/CcspCrSsp_Restarted
ls: /tmp/CcspCrSsp_Restarted: No such file or directory
root@Docsis-Gateway:~#

Thanks,
Vinothkumar
-----Original Message-----
From: systemd-devel <systemd-devel-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Reindl Harald
Sent: 10 June 2020 12:27
To: systemd-devel@xxxxxxxxxxxxxxxxxxxxx
Subject: Re:  [EXTERNAL] Re: ExecStop doesn't get called when service crashes



Am 10.06.20 um 05:27 schrieb Baskaran, Vinothkumar:
> Hi Reindal,
>
> Thanks for the inputs.
>
> In my case, the service is successfully started. The pre-script's return status is also success. Please find the output below. Still, ExecStop doesn't get invoked. I tried replacing it with ExecStopPost, it gets invoked successfully.  But, ExecStopPost cannot be used, since it gets invoked on failed cases too.

your subject "ExecStop doesn't get called when service crashes" simply makes no sense at all then  because that's what a failed case is

> -----Original Message-----
> From: Reindl Harald <h.reindl@xxxxxxxxxxxxx>
> Sent: 09 June 2020 22:37
> To: Baskaran, Vinothkumar <Vinothkumar_Baskaran@xxxxxxxxxxx>;
> systemd-devel@xxxxxxxxxxxxxxxxxxxxx
> Subject: [EXTERNAL] Re:  ExecStop doesn't get called
> when service crashes
>
>
>
> Am 09.06.20 um 18:07 schrieb Baskaran, Vinothkumar:
>> I am using systemd-244 in embedded linux yocto 3.1. Here, ExecStop
>> doesn’t get invoked when the process CcspCrSspis killed. However,
>> when service is restarted/stopped using ‘systemctl’, it gets invoked
>> successfully. The system has many services with ExecStop and it
>> doesn’t gets invoked in any of them. I have pasted one of the unit file here.
>> Please let me know if I am missing anything.
>
> yes, the docs:
> https://urldefense.com/v3/__https://www.freedesktop.org/software/syste
> md/man/systemd.service.html__;!!CQl3mcHX2A!XMPI4FzT0dPBtcTPcJHQ0uoBtgT
> QQGG7Jx81VeUd35HN-KqSWIh7zza7ga4FSP38Sqlii7ebRg$
>
> ExecStop=
> Note that the commands specified in ExecStop= are only executed when
> the service started successfully first. They are not invoked if the
> service was never started at all, or in case its start-up failed, for
> example because any of the commands specified in ExecStart=,
> ExecStartPre= or ExecStartPost= failed (and weren't prefixed with "-",
> see above) or timed out. Use ExecStopPost= to invoke commands when a
> service failed to start up correctly and is shut down again
>
> ExecStopPost=
> Additional commands that are executed after the service is stopped.
> This includes cases where the commands configured in ExecStop= were
> used, where the service does not have any ExecStop= defined, or where
> the service exited unexpectedly
>

--

Reindl Harald
the lounge interactive design GmbH
A-1060 Vienna, Hofmühlgasse 17
CTO / CISO / Software-Development
m: +43 676 40 221 40
p: +43 1 595 3999 33
https://urldefense.com/v3/__http://www.thelounge.net/__;!!CQl3mcHX2A!TACLhgaxBz1TnrvE0aQ-KCuNz4937r9GfsE0vDfZcXUHs4V_srhlcyak1yCIazUhBDE_Atqejw$

GPG-Public-Key:
https://urldefense.com/v3/__https://arrakis-tls.thelounge.net/gpg/h.reindl_thelounge.net.pub.txt__;!!CQl3mcHX2A!TACLhgaxBz1TnrvE0aQ-KCuNz4937r9GfsE0vDfZcXUHs4V_srhlcyak1yCIazUhBDHob_BiuA$
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://urldefense.com/v3/__https://lists.freedesktop.org/mailman/listinfo/systemd-devel__;!!CQl3mcHX2A!TACLhgaxBz1TnrvE0aQ-KCuNz4937r9GfsE0vDfZcXUHs4V_srhlcyak1yCIazUhBDHbA5LHGA$
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux