mirror of
https://github.com/troglobit/finit.git
synced 2026-10-10 16:52:39 +07:00
initctl: add reboot, halt, and poweroff commands
Simple wrappers for the signals Finit responds to. Will need complete rewrite when support for delayed reboot/halt is added. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -21,7 +21,6 @@ General
|
||||
* Add halt/poweroff/shutdown symlinks to finit and convert reboot, but
|
||||
only install symlinks if these tools don't already exist.
|
||||
* Add support for timed shutdown in Finit, including cancelled shutdown.
|
||||
* Add reboot, halt, poweroff commands to `initctl` tool
|
||||
* SysV init and systemd use SIGUSR1 to restart their FIFO/D-Bus. Add
|
||||
API restart to SIGHUP callback for the same functionality in Finit.
|
||||
* Add `finit.conf` support for UPS notification (SIGPWR) to start a task
|
||||
|
||||
@@ -276,6 +276,10 @@ static int do_cond(char *cmd)
|
||||
return do_cond_show(NULL);
|
||||
}
|
||||
|
||||
static int do_halt (char *UNUSED(arg)) { return kill(1, SIGUSR1); }
|
||||
static int do_poweroff(char *UNUSED(arg)) { return kill(1, SIGUSR2); }
|
||||
static int do_reboot (char *UNUSED(arg)) { return kill(1, SIGTERM); }
|
||||
|
||||
static int show_version(char *UNUSED(arg))
|
||||
{
|
||||
puts("v" PACKAGE_VERSION);
|
||||
@@ -413,6 +417,9 @@ static int usage(int rc)
|
||||
" start <JOB|NAME>[:ID] Start service by job# or name, with optional ID\n"
|
||||
" stop <JOB|NAME>[:ID] Stop/Pause a running service by job# or name\n"
|
||||
" restart <JOB|NAME>[:ID] Restart (stop/start) service by job# or name\n"
|
||||
" reboot Reboot system\n"
|
||||
" halt Halt system\n"
|
||||
" poweroff Halt and power off system\n"
|
||||
" version Show Finit version\n\n", __progname);
|
||||
|
||||
return rc;
|
||||
@@ -431,6 +438,9 @@ int main(int argc, char *argv[])
|
||||
{ "start", do_start },
|
||||
{ "stop", do_stop },
|
||||
{ "restart", do_restart },
|
||||
{ "reboot", do_reboot },
|
||||
{ "halt", do_halt },
|
||||
{ "poweroff", do_poweroff },
|
||||
{ "version", show_version },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user