Note that if you are calling from C code, you might want to call it
through the Dbus API, rather than the "system" system call.
As for debugging what blocks the shutdown, here are a few clues
* does "systemctl reboot -f" stop the system correctly ?
if yes, one of your daemons is blocking
On Tue, 07.03.17 03:15, lin webber (webber...@outlook.com) wrote:
> I use “system("reboot")” in my C program and system does not shutdown.I think
> that systemd is waiting for some services to shutdown which can't shutdown
> immediately.
> But I don't want to wait for those services to
In that case, you could also just do something like this:
# for i in {u,s,b}; do echo $i > /proc/sysrq-trigger; done
For "Remount read-only, Sync, (re)Boot". There are also hotkey sequences
to do that (the modern equivalent of the three fingered salute) which might
be more appropriate in the case
> But I don't want to wait for those services to shutdown.
Then there's no reason to interact with systemd if you want to force an
immediate, unclean reboot. You just want something like the reboot syscall
with LINUX_REBOOT_CMD_RESTART.
___
I use “system("reboot")” in my C program and system does not shutdown.I think
that systemd is waiting for some services to shutdown which can't shutdown
immediately.
But I don't want to wait for those services to shutdown.How can I shutdown my
system immediately in my C program.which API should