mirror of
https://github.com/troglobit/finit.git
synced 2026-10-12 10:12:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a822a7657c | ||
|
|
e46271c1a9 | ||
|
|
1028725079 | ||
|
|
ed5ee667ae | ||
|
|
4c3e053041 | ||
|
|
a5c5a5c644 | ||
|
|
fa3a97366c | ||
|
|
5b3e3da7ff | ||
|
|
59d96f264d | ||
|
|
7027cbc439 |
+32
-1
@@ -3,6 +3,34 @@ Change Log
|
|||||||
|
|
||||||
All relevant changes are documented in this file.
|
All relevant changes are documented in this file.
|
||||||
|
|
||||||
|
|
||||||
|
[2.4][] - 2015-12-04
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Bug fix release.
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
* Add support for status/show service by `name:id`
|
||||||
|
* Enforce terse mode after boot, if verbose mode is disabled
|
||||||
|
* Reenable verbose mode at reboot, if disabled at boot
|
||||||
|
* Update section mentioning BusyBox getty
|
||||||
|
* Update debugging documentation
|
||||||
|
* Allow debug to override terse mode
|
||||||
|
* Revert confusing change in service state introduced in [v2.3][].
|
||||||
|
As of v2.4 services are listed as "halted" and "stopped", when
|
||||||
|
they have been halted due to a runlevel changed or stopped by
|
||||||
|
the user, respectively.
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Fix system freeze at reconfiguration. Changed services that
|
||||||
|
all support `SIGHUP` caused a freeze due to Finit waiting for
|
||||||
|
them to stop.
|
||||||
|
* Make sure to start and/or `SIGHUP` services after reconfiguration
|
||||||
|
when there was no services to stop.
|
||||||
|
|
||||||
|
|
||||||
[2.3][] - 2015-11-28
|
[2.3][] - 2015-11-28
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
@@ -454,7 +482,10 @@ Major bug fix release.
|
|||||||
|
|
||||||
* Initial release
|
* Initial release
|
||||||
|
|
||||||
[UNRELEASED]: https://github.com/troglobit/finit/compare/2.1...HEAD
|
[UNRELEASED]: https://github.com/troglobit/finit/compare/2.4...HEAD
|
||||||
|
[2.4]: https://github.com/troglobit/finit/compare/2.3...2.4
|
||||||
|
[2.3]: https://github.com/troglobit/finit/compare/2.2...2.3
|
||||||
|
[2.2]: https://github.com/troglobit/finit/compare/2.1...2.2
|
||||||
[2.1]: https://github.com/troglobit/finit/compare/2.0...2.1
|
[2.1]: https://github.com/troglobit/finit/compare/2.0...2.1
|
||||||
[2.0]: https://github.com/troglobit/finit/compare/1.12...2.0
|
[2.0]: https://github.com/troglobit/finit/compare/1.12...2.0
|
||||||
[1.12]: https://github.com/troglobit/finit/compare/1.11...1.12
|
[1.12]: https://github.com/troglobit/finit/compare/1.11...1.12
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
uninstall-exec uninstall-data uninstall-dev
|
uninstall-exec uninstall-data uninstall-dev
|
||||||
|
|
||||||
#VERSION = $(shell git tag -l | tail -1)
|
#VERSION = $(shell git tag -l | tail -1)
|
||||||
VERSION = 2.3
|
VERSION = 2.4
|
||||||
NAME = finit
|
NAME = finit
|
||||||
PKG = $(NAME)-$(VERSION)
|
PKG = $(NAME)-$(VERSION)
|
||||||
DEV = $(NAME)-dev
|
DEV = $(NAME)-dev
|
||||||
|
|||||||
@@ -197,6 +197,11 @@ Syntax:
|
|||||||
See `finit.h` for the `#define GETTY` that is called, along with the
|
See `finit.h` for the `#define GETTY` that is called, along with the
|
||||||
default baud rate.
|
default baud rate.
|
||||||
|
|
||||||
|
**Note:** BusyBox getty, used when Finit is built for embedded
|
||||||
|
systems, can take a `DEV` with *or* without `/dev/` prefix. Make
|
||||||
|
sure to call the configure script with `--enable-embedded` if this
|
||||||
|
is what you want.
|
||||||
|
|
||||||
* `console <DEV | /path/to/cmd [args]>`
|
* `console <DEV | /path/to/cmd [args]>`
|
||||||
Some embedded systems have a dedicated serial console/service port.
|
Some embedded systems have a dedicated serial console/service port.
|
||||||
This command tells finit to not start getty directly, since there may
|
This command tells finit to not start getty directly, since there may
|
||||||
@@ -823,9 +828,9 @@ give the kernel the following extra command line:
|
|||||||
Debugging
|
Debugging
|
||||||
---------
|
---------
|
||||||
|
|
||||||
Add `finit_debug`, or `--debug`, to the kernel command line to
|
Add `finit_debug`, or `--debug`, to the kernel command line to enable
|
||||||
enable trace messages. A console getty is always started, see the file
|
debug messages. See the output from `configure --help` for more on
|
||||||
`finit.h` for more useful compile-time tweaks:
|
how to assist debugging.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
init=/sbin/finit --debug
|
init=/sbin/finit --debug
|
||||||
|
|||||||
@@ -266,6 +266,10 @@ static void cb(uev_t *w, void *UNUSED(arg), int UNUSED(events))
|
|||||||
|
|
||||||
case INIT_CMD_DEBUG:
|
case INIT_CMD_DEBUG:
|
||||||
debug = !debug;
|
debug = !debug;
|
||||||
|
if (debug)
|
||||||
|
verbose = 1;
|
||||||
|
else
|
||||||
|
verbose = quiet ? 0 : VERBOSE_MODE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INIT_CMD_RELOAD: /* 'init q' and 'initctl reload' */
|
case INIT_CMD_RELOAD: /* 'init q' and 'initctl reload' */
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ int main(int argc, char* argv[])
|
|||||||
tty_runlevel(runlevel);
|
tty_runlevel(runlevel);
|
||||||
|
|
||||||
/* Disable verbose mode, if selected */
|
/* Disable verbose mode, if selected */
|
||||||
if (quiet)
|
if (quiet && !debug)
|
||||||
verbose = 0;
|
verbose = 0;
|
||||||
|
|
||||||
/* Start new initctl API responder */
|
/* Start new initctl API responder */
|
||||||
|
|||||||
@@ -142,6 +142,9 @@ void print(int action, const char *fmt, ...)
|
|||||||
const char pending[] = " \e[1m[ \\/ ]\e[0m\n";
|
const char pending[] = " \e[1m[ \\/ ]\e[0m\n";
|
||||||
const char dots[] = " .....................................................................";
|
const char dots[] = " .....................................................................";
|
||||||
|
|
||||||
|
if (!verbose)
|
||||||
|
return;
|
||||||
|
|
||||||
if (fmt) {
|
if (fmt) {
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
len = vsnprintf(buf, sizeof(buf), fmt, ap);
|
len = vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||||
|
|||||||
@@ -136,13 +136,38 @@ static int show_version(char *UNUSED(arg))
|
|||||||
/* In verbose mode we skip the header and each service description.
|
/* In verbose mode we skip the header and each service description.
|
||||||
* This in favor of having all info on one line so a machine can more
|
* This in favor of having all info on one line so a machine can more
|
||||||
* easily parse it. */
|
* easily parse it. */
|
||||||
static int show_status(char *UNUSED(arg))
|
static int show_status(char *arg)
|
||||||
{
|
{
|
||||||
svc_t *svc;
|
svc_t *svc;
|
||||||
|
|
||||||
/* Fetch UTMP runlevel, needed for svc_status() call below */
|
/* Fetch UTMP runlevel, needed for svc_status() call below */
|
||||||
runlevel = runlevel_get();
|
runlevel = runlevel_get();
|
||||||
|
|
||||||
|
if (arg && arg[0]) {
|
||||||
|
int id = 1;
|
||||||
|
char *ptr, *next;
|
||||||
|
|
||||||
|
ptr = strchr(arg, ':');
|
||||||
|
if (ptr) {
|
||||||
|
*ptr++ = 0;
|
||||||
|
next = strchr(ptr, ' ');
|
||||||
|
if (next)
|
||||||
|
*next = 0;
|
||||||
|
id = atonum(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isdigit(arg[0]))
|
||||||
|
svc = svc_find_by_jobid(atonum(arg), id);
|
||||||
|
else
|
||||||
|
svc = svc_find_by_nameid(arg, id);
|
||||||
|
|
||||||
|
if (!svc)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
printf("%s\n", svc_status(svc));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!verbose) {
|
if (!verbose) {
|
||||||
printf("# Status PID Runlevels Service Description\n");
|
printf("# Status PID Runlevels Service Description\n");
|
||||||
printf("====================================================================================\n");
|
printf("====================================================================================\n");
|
||||||
@@ -229,6 +254,8 @@ static int usage(int rc)
|
|||||||
" 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"
|
||||||
" reload <JOB|NAME>[:ID] Reload (SIGHUP) service by job# or name\n"
|
" reload <JOB|NAME>[:ID] Reload (SIGHUP) service by job# or name\n"
|
||||||
|
" status <JOB|NAME>[:ID] Show status of a service by job# or name\n"
|
||||||
|
" show <JOB|NAME>[:ID] Alias to 'status <JOB|NAME>[:ID]'\n"
|
||||||
" version Show Finit version\n\n", __progname);
|
" version Show Finit version\n\n", __progname);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|||||||
@@ -399,12 +399,12 @@ static int service_stop_done(svc_t *svc)
|
|||||||
if (svc && dyn_stop_cnt)
|
if (svc && dyn_stop_cnt)
|
||||||
dyn_stop_cnt--;
|
dyn_stop_cnt--;
|
||||||
|
|
||||||
|
_d("dyn_stop_cnt %d", dyn_stop_cnt);
|
||||||
if (!dyn_stop_cnt) {
|
if (!dyn_stop_cnt) {
|
||||||
_d("All disabled/removed services have been stoppped, calling reconf hooks ...");
|
_d("All disabled/removed services have been stoppped, calling reconf hooks ...");
|
||||||
plugin_run_hooks(HOOK_SVC_RECONF); /* Reconfigure HW/VLANs/etc here */
|
plugin_run_hooks(HOOK_SVC_RECONF); /* Reconfigure HW/VLANs/etc here */
|
||||||
|
|
||||||
/* Finish off by starting/reload modified/new services */
|
/* Finish off by starting/reload modified/new services */
|
||||||
if (svc && svc->state == SVC_RELOAD_STATE)
|
|
||||||
service_start_dynamic();
|
service_start_dynamic();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,7 +430,9 @@ void service_stop_dynamic(void)
|
|||||||
if (svc_is_removed(svc))
|
if (svc_is_removed(svc))
|
||||||
new_state = SVC_HALTED_STATE;
|
new_state = SVC_HALTED_STATE;
|
||||||
|
|
||||||
|
if (!svc_has_sighup(svc))
|
||||||
dyn_stop_cnt++;
|
dyn_stop_cnt++;
|
||||||
|
|
||||||
_d("Marking service %s as state %d", svc->cmd, new_state);
|
_d("Marking service %s as state %d", svc->cmd, new_state);
|
||||||
service_stop(svc, new_state);
|
service_stop(svc, new_state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,12 +38,14 @@
|
|||||||
* It activates the kbrequest action.
|
* It activates the kbrequest action.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sched.h>
|
||||||
#include <string.h> /* strerror() */
|
#include <string.h> /* strerror() */
|
||||||
#include <sys/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
#include "finit.h"
|
#include "finit.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "config.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
@@ -64,6 +66,15 @@ void do_shutdown(int sig)
|
|||||||
if (sdown)
|
if (sdown)
|
||||||
run_interactive(sdown, "Calling shutdown hook: %s", sdown);
|
run_interactive(sdown, "Calling shutdown hook: %s", sdown);
|
||||||
|
|
||||||
|
/* If we enabled terse mode at boot, restore to previous setting at shutdown */
|
||||||
|
if (quiet) {
|
||||||
|
verbose = VERBOSE_MODE;
|
||||||
|
if (verbose) {
|
||||||
|
sched_yield();
|
||||||
|
fputs("\n", stderr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Call all shutdown hooks before rebooting... */
|
/* Call all shutdown hooks before rebooting... */
|
||||||
plugin_run_hooks(HOOK_SHUTDOWN);
|
plugin_run_hooks(HOOK_SHUTDOWN);
|
||||||
|
|
||||||
|
|||||||
@@ -407,14 +407,14 @@ int svc_clean_bootstrap(svc_t *svc)
|
|||||||
char *svc_status(svc_t *svc)
|
char *svc_status(svc_t *svc)
|
||||||
{
|
{
|
||||||
if (!svc_in_runlevel(svc, runlevel))
|
if (!svc_in_runlevel(svc, runlevel))
|
||||||
return "stopped";
|
return "halted";
|
||||||
|
|
||||||
switch (svc->state) {
|
switch (svc->state) {
|
||||||
case SVC_WAITING_STATE:
|
case SVC_WAITING_STATE:
|
||||||
return "waiting";
|
return "waiting";
|
||||||
|
|
||||||
case SVC_PAUSED_STATE:
|
case SVC_PAUSED_STATE:
|
||||||
return "paused";
|
return "stopped";
|
||||||
|
|
||||||
case SVC_CONDHALT_STATE:
|
case SVC_CONDHALT_STATE:
|
||||||
return "nocond";
|
return "nocond";
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ int svc_next_id (char *cmd);
|
|||||||
int svc_is_unique (svc_t *svc);
|
int svc_is_unique (svc_t *svc);
|
||||||
|
|
||||||
static inline int svc_in_runlevel(svc_t *svc, int runlevel) { return svc && ISSET(svc->runlevels, runlevel); }
|
static inline int svc_in_runlevel(svc_t *svc, int runlevel) { return svc && ISSET(svc->runlevels, runlevel); }
|
||||||
|
static inline int svc_has_sighup(svc_t *svc) { return svc && 0 != svc->sighup; }
|
||||||
|
|
||||||
static inline int svc_is_dynamic(svc_t *svc) { return svc && 0 != svc->mtime; }
|
static inline int svc_is_dynamic(svc_t *svc) { return svc && 0 != svc->mtime; }
|
||||||
static inline int svc_is_removed(svc_t *svc) { return svc && -1 == svc->dirty; }
|
static inline int svc_is_removed(svc_t *svc) { return svc && -1 == svc->dirty; }
|
||||||
|
|||||||
Reference in New Issue
Block a user