if shutting down computer from GUI is the same as from terminal with command:
It depends on the GUI, of course, but most of the time a DBus message is sent, either to init directly or to something like ConsoleKit / systemd-logind.
While both methods eventually result in telling init to start the shutdown process, they mainly differ in what kind of authorization they use, e.g. shutdown via systemd-logind can be initiated by anyone logged in at the console, while the
shutdown command is usually root-only.
(The same does not apply to
systemctl poweroff, though, which goes through a more GUI-like mechanism than
Does init process receive any signal like SIGPWR or SIGTERM or it shuts down differently? Hope you can help. Thanks.
It depends on the init system, of course, but most of the time an IPC message is sent, either via D-Bus, a plain Unix socket, or a named pipe.
systemd has D-Bus and
/run/systemd/private as fallback;
Upstart has D-Bus and apparently
/run/initctl as well;
SysV init has
(SIGPWR has a different meaning – it merely informs init that there was a power failure, without explicitly requesting any action.)