mirror of
https://github.com/troglobit/finit.git
synced 2026-10-22 11:36:07 +00: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:
1 parent
6490735ee9
commit
baa914e995
2 files changed
+10
-1
No files matched your search
@@ -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