[systemd-devel] A question about the race condition between two service
piliu
piliu at redhat.com
Mon Nov 5 06:17:32 UTC 2018
On 11/01/2018 05:52 PM, Andrei Borzenkov wrote:
> On Thu, Nov 1, 2018 at 11:34 AM piliu <piliu at redhat.com> wrote:
>>
>> Hi,
>>
>> I encounter an issue during the poweroff. In my bash script, firstly I
>> use poweroff cmd to start systemd-poweroff.service, and use reboot cmd
>> as a bake up if the poweroff fails. But during tests, many times, the
>> machine is rebooted directly, without waiting for the result of poweroff.
>> Since both of the cmds use "systemctl" without --no-block option, so I
>> think they should execute one-by-one. But the test result is not.
>> Any suggestion?
>>
>
>
> Most likely your systemctl is killed during shutdown processing (which
> is implicitly initiated by systemd-poweroff.service).
>
During this service, the power state can not be got from sysfs, neither
it can be got by systemd's utility. So is it acceptable to signal the
failure of service by a tmp file under /tmp ? I.e adding
FailureAction=touch /tmp/poweroff_fail in systemd-poweroff.service.
Thanks,
Pingfan
More information about the systemd-devel
mailing list