Replace verbose and kernel quiet modes with silent and quiet

This patch replaces the verbose and kernel-quiet runtime options with
a (hopefully) more useful quiet and silent modes of operation.

By default Finit progressively shows all services it starts at boot, but
when boot has completed and services are started/restarted Finit prints
nothing.  If `--disable-quiet` is given all started/restared/stoppping
messages are shown even after boot.

However, if `--enable-silent` is given Finit is completely silent even
at boot, no progress is shown, until the first service is started, which
on most systems is login.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2016-04-11 00:50:37 +02:00
1 parent c4af8b7cbd
commit 1f1c2e0466
12 files changed
+43 -43

No files matched your search

+9 -9
View File
@@ -121,7 +121,7 @@ static int service_start(svc_t *svc)
/* Don't try and start service if it doesn't exist. */
if (!fexist(svc->cmd) && !svc->inetd.cmd) {
if (verbose) {
if (!silent) {
char msg[80];
snprintf(msg, sizeof(msg), "Service %s does not exist!", svc->cmd);
@@ -137,7 +137,7 @@ static int service_start(svc_t *svc)
if (is_norespawn())
return 1;
if (verbose) {
if (!silent) {
if (svc_is_daemon(svc) || svc_is_inetd(svc))
print_desc("Starting ", svc->desc);
else
@@ -147,7 +147,7 @@ static int service_start(svc_t *svc)
#ifndef INETD_DISABLED
if (svc_is_inetd(svc)) {
result = inetd_start(&svc->inetd);
if (verbose)
if (!silent)
print_result(result);
return result;
}
@@ -258,7 +258,7 @@ static int service_start(svc_t *svc)
svc->pid = 0;
}
if (verbose)
if (!silent)
print_result(result);
return 0;
@@ -280,7 +280,7 @@ static int service_stop(svc_t *svc)
#ifndef INETD_DISABLED
if (svc_is_inetd(svc)) {
int do_print = runlevel != 1 && verbose &&
int do_print = runlevel != 1 && !silent &&
svc->block != SVC_BLOCK_INETD_BUSY;
if (do_print)
@@ -302,13 +302,13 @@ static int service_stop(svc_t *svc)
if (SVC_TYPE_SERVICE != svc->type)
return 0;
if (runlevel != 1 && verbose)
if (runlevel != 1 && !silent)
print_desc("Stopping ", svc->desc);
_d("Sending SIGTERM to pid:%d name:%s", svc->pid, pid_get_name(svc->pid, NULL, 0));
res = kill(svc->pid, SIGTERM);
if (runlevel != 1 && verbose)
if (runlevel != 1 && !silent)
print_result(res);
return res;
@@ -341,7 +341,7 @@ static int service_restart(svc_t *svc)
return 1;
}
if (verbose)
if (!silent)
print_desc("Restarting ", svc->desc);
/* Declare we're waiting for svc to re-assert/touch its pidfile */
@@ -350,7 +350,7 @@ static int service_restart(svc_t *svc)
_d("Sending SIGHUP to PID %d", svc->pid);
err = kill(svc->pid, SIGHUP);
if (verbose)
if (!silent)
print_result(err);
return err;
}