mirror of
https://github.com/troglobit/finit.git
synced 2026-11-10 16:31:21 +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
@@ -21,7 +21,6 @@ General
|
|||||||
* Add halt/poweroff/shutdown symlinks to finit and convert reboot, but
|
* Add halt/poweroff/shutdown symlinks to finit and convert reboot, but
|
||||||
only install symlinks if these tools don't already exist.
|
only install symlinks if these tools don't already exist.
|
||||||
* Add support for timed shutdown in Finit, including cancelled shutdown.
|
* 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
|
* SysV init and systemd use SIGUSR1 to restart their FIFO/D-Bus. Add
|
||||||
API restart to SIGHUP callback for the same functionality in Finit.
|
API restart to SIGHUP callback for the same functionality in Finit.
|
||||||
* Add `finit.conf` support for UPS notification (SIGPWR) to start a task
|
* 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);
|
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))
|
static int show_version(char *UNUSED(arg))
|
||||||
{
|
{
|
||||||
puts("v" PACKAGE_VERSION);
|
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"
|
" 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"
|
" 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"
|
" 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);
|
" version Show Finit version\n\n", __progname);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -431,6 +438,9 @@ int main(int argc, char *argv[])
|
|||||||
{ "start", do_start },
|
{ "start", do_start },
|
||||||
{ "stop", do_stop },
|
{ "stop", do_stop },
|
||||||
{ "restart", do_restart },
|
{ "restart", do_restart },
|
||||||
|
{ "reboot", do_reboot },
|
||||||
|
{ "halt", do_halt },
|
||||||
|
{ "poweroff", do_poweroff },
|
||||||
{ "version", show_version },
|
{ "version", show_version },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user