<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Dec 20, 2017 at 7:54 PM, Zygmunt Ptak <span dir="ltr"><<a href="mailto:zygmuntptak@gmail.com" target="_blank">zygmuntptak@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi systemd devs and users,<br>
<br>
I want to implement custom power off method.<br>
I added to the yocto script: /usr/sbin/halt.local which will power off<br>
my machine.<br>
<br>
But from what I see it is not correct.<br>
Ive got this from my machine:<br>
<br>
[  OK  ] Reached target Shutdown.<br>
         Starting /usr/sbin/halt.local Compatibility...<br>
My power off<br>
[   76.916101] EXT4-fs (mmcblk1p1): re-mounted. Opts: (null)<br>
[  OK  ] Started /usr/sbin/halt.local Compatibility.<br>
[  OK  ] Reached target Final Step.<br>
         Starting Power-Off...<br>
[   77.102708] systemd-shutdown[1]: Sending SIGTERM to remaining processes...<br>
[   77.124900] systemd-journald[203]: Received SIGTERM from PID 1<br>
(systemd-shutdow).<br>
[   77.174386] systemd-shutdown[1]: Sending SIGKILL to remaining processes...<br>
[   77.194122] systemd-shutdown[1]: Unmounting file systems.<br>
[   77.200107] systemd-shutdown[1]: Remounting '/var/volatile'<br>
read-only with options ''.<br>
[   77.208187] systemd-shutdown[1]: Unmounting /var/volatile.<br>
[   77.253911] systemd-shutdown[1]: Remounting '/tmp' read-only with options ''.<br>
[   77.261142] systemd-shutdown[1]: Unmounting /tmp.<br>
[   77.314075] systemd-shutdown[1]: Remounting '/' read-only with<br>
options 'data=ordered'.<br>
[   77.322732] EXT4-fs (mmcblk1p1): re-mounted. Opts: data=ordered<br>
[   77.328818] systemd-shutdown[1]: Remounting '/' read-only with<br>
options 'data=ordered'.<br>
[   77.336983] EXT4-fs (mmcblk1p1): re-mounted. Opts: data=ordered<br>
[   77.342981] systemd-shutdown[1]: Remounting '/' read-only with<br>
options 'data=ordered'.<br>
[   77.351167] EXT4-fs (mmcblk1p1): re-mounted. Opts: data=ordered<br>
[   77.357245] systemd-shutdown[1]: All filesystems unmounted.<br>
[   77.362835] systemd-shutdown[1]: Deactivating swaps.<br>
[   77.367923] systemd-shutdown[1]: All swaps deactivated.<br>
[   77.373168] systemd-shutdown[1]: Detaching loop devices.<br>
[   77.390252] systemd-shutdown[1]: All loop devices detached.<br>
[   77.395883] systemd-shutdown[1]: Detaching DM devices.<br>
[   77.401337] systemd-shutdown[1]: All DM devices detached.<br>
[   77.409285] systemd-shutdown[1]: Powering off.<br>
[   77.431515] reboot: System halted<br>
<br>
"My power off" will power off machine, but to early.<br>
<br>
I want to call my script after:<br>
"[   77.409285] systemd-shutdown[1]: Powering off."<br></blockquote><div><br></div><div>Generally, programs no longer run after the computer has been powered off...</div><div><br></div><div>To run custom code *before* systemd powers off (or halts) the system:</div><div><br></div><div>a) Use a shutdown hook (man systemd-shutdown),</div><div>or b) Use a shutdown initramfs (/run/initramfs/shutdown).</div></div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div>
</div></div>