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. – dessert Jan 23 '19 at 13:26file $(which shutdown)to see whatshutdownin fact is. ;) Well, I suppose there’s not really a difference… – dessert Jan 23 '19 at 13:37qdbus org.kde.ksmserver /KSMServer logout 0 2 0is what you want. This is from https://superuser.com/a/396091/. – jamadagni Feb 03 '19 at 03:27