@Seven.of.nine , @Edz your command invocations are catched by the mentioned wrapper. That said, it applies only for interactive execution (bash). For applications, scripts, etc the right way should be explicitly considered and that is my case here. For example a kill switch …
As SailfishOS is using systemd init system, I guess that best way is to use systemctl poweroff. As the /usr/sbin/poweroff is symlink to /usr/bin/systemctl, it behaves like alias I believe…
BTW, is it possible to shutdown the device via CLI as normal user (or script/bin) by using the dsmetool interface? Any DBUS or polkit possibilities available?
for my battInfo helper app for Xperia 10 V (until sony/jolla will fix battery status) i looking if there is better solution to poweroff phone within app than using privileged perms?
(yes, perhaps making patch for some system qml like StatusArea.qml or some other with timer may be the better solution, but actually i have no time for that now )
reason: people asking for this because they may not hear low battery notification or they may sleep or just be away from phone…
shutdown now or init 0 tell systemd to bring the system down in a clean way, i.e. unmount the filesystems and gracefully end all processes in a reasonable order. If that fails due to a problem with systemd itself or since some required action fails, you can still tell the kernel to forcefully power off:
echo 1 > /proc/sys/kernel/sysrq
echo o > /proc/sysrq-trigger
Disclaimer: If that breaks your phone, you may keep the pieces.
SFOS is a bit special - “shutdown” is wrapper around dsmetool and its the preferred and official way to bring system down and should not be bypassed. It does some pretasks for correct app signaling, alarms and hw stuff like led trigger etc.