[systemd-devel] proper way to shutdown/reboot host with systemd

Thomas Suckow thomas.suckow at pnnl.gov
Tue Aug 26 12:06:47 PDT 2014


On 08/26/2014 11:54 AM, Vasiliy Tolstov wrote:
> 2014-08-26 21:32 GMT+04:00 Lennart Poettering <lennart at poettering.net>:
>>  From which language? From C, I'd recommend issuing the PowerOff() method
>> on logind's manager object via the bus. From the shell, i'd recommend
>> "systemctl poweroff", which does exactly that.
>
>
> Thanks, but does it possible to shutdown system via reboot syscall for
> example with LINUX_REBOOT_CMD_POWER_OFF ?

No.

http://linux.die.net/man/2/reboot
Note the repeating statement of "If not preceded by a sync(2), data will be lost."

I would follow Lennart's advice.

-
Thomas


More information about the systemd-devel mailing list