diff options
author | William Hubbs <w.d.hubbs@gmail.com> | 2017-09-14 18:24:31 -0500 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2017-09-14 18:24:39 -0500 |
commit | b0a077a35f85e266fdb82a245dcbda18664a8567 (patch) | |
tree | c2edf38310bd2e3a1d0ef5d9e4367780731755f4 /src/rc/rc-schedules.c | |
parent | 6a5ca2ab368d0a85f51bb559672dba2e3ffcc6be (diff) |
add quiet switch to do_stop in src-schedules.c
This allows supervise-daemon to run this code without attempting to
print some status messages used by start-stop-daemon.
Diffstat (limited to 'src/rc/rc-schedules.c')
-rw-r--r-- | src/rc/rc-schedules.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/rc/rc-schedules.c b/src/rc/rc-schedules.c index 1b235a8d..13f615ee 100644 --- a/src/rc/rc-schedules.c +++ b/src/rc/rc-schedules.c @@ -253,7 +253,7 @@ void parse_schedule(const char *applet, const char *string, int timeout) /* return number of processes killed, -1 on error */ int do_stop(const char *applet, const char *exec, const char *const *argv, - pid_t pid, uid_t uid,int sig, bool test) + pid_t pid, uid_t uid,int sig, bool test, bool quiet) { RC_PIDLIST *pids; RC_PID *pi; @@ -274,11 +274,13 @@ int do_stop(const char *applet, const char *exec, const char *const *argv, einfo("Would send signal %d to PID %d", sig, pi->pid); nkilled++; } else { - ebeginv("Sending signal %d to PID %d", sig, pi->pid); + if (!quiet) + ebeginv("Sending signal %d to PID %d", sig, pi->pid); errno = 0; killed = (kill(pi->pid, sig) == 0 || errno == ESRCH ? true : false); - eendv(killed ? 0 : 1, + if (! quiet) + eendv(killed ? 0 : 1, "%s: failed to send signal %d to PID %d: %s", applet, sig, pi->pid, strerror(errno)); if (!killed) { @@ -335,7 +337,8 @@ int run_stop_schedule(const char *applet, case SC_SIGNAL: nrunning = 0; - nkilled = do_stop(applet, exec, argv, pid, uid, item->value, test); + nkilled = do_stop(applet, exec, argv, pid, uid, item->value, test, + quiet); if (nkilled == 0) { if (tkilled == 0) { if (progressed) @@ -364,7 +367,7 @@ int run_stop_schedule(const char *applet, nloops++) { if ((nrunning = do_stop(applet, exec, argv, - pid, uid, 0, test)) == 0) + pid, uid, 0, test, quiet)) == 0) return 0; |