I want to shutdown computer with my phone using KDE Connect. That can be easily done by adding a shutdown command in the setting of the Runcommand plugin within the KDE Connect program in Linux.
The idea is to close the applications gracefully without abruptly killing them and losing last configurations, for example.
I know about systemctl poweroff
.
I read under this question that "shutdown -h now
or shutdown -r now
are graceful", and also that scripts involved may vary depending on the distribution. What is the situation in Ubuntu?
Are the commands above preferable to systemctl poweroff
for my purpose?
SIGTERM
– that’skill
’s default signal and widely considered to be The Right Thing™ to do. Most importantly, every reasonable software saves its data and only then exits when receiving this signal.file $(which shutdown)
to see whatshutdown
in fact is. ;) Well, I suppose there’s not really a difference…qdbus org.kde.ksmserver /KSMServer logout 0 2 0
is what you want. This is from superuser.com/a/396091.