add quiet parameter to run_stop_schedule

This commit is contained in:
William Hubbs 2017-09-06 16:43:28 -05:00
parent 17b5cc78d3
commit 382efdbfcb
4 changed files with 9 additions and 8 deletions

View File

@ -298,7 +298,7 @@ int do_stop(const char *applet, const char *exec, const char *const *argv,
int run_stop_schedule(const char *applet, int run_stop_schedule(const char *applet,
const char *exec, const char *const *argv, const char *exec, const char *const *argv,
pid_t pid, uid_t uid, pid_t pid, uid_t uid,
bool test, bool progress) bool test, bool progress, bool quiet)
{ {
SCHEDULEITEM *item = TAILQ_FIRST(&schedule); SCHEDULEITEM *item = TAILQ_FIRST(&schedule);
int nkilled = 0; int nkilled = 0;
@ -409,6 +409,7 @@ int run_stop_schedule(const char *applet,
if (progressed) if (progressed)
printf("\n"); printf("\n");
if (! quiet)
if (nrunning == 1) if (nrunning == 1)
eerror("%s: %d process refused to stop", applet, nrunning); eerror("%s: %d process refused to stop", applet, nrunning);
else else

View File

@ -22,6 +22,6 @@ int do_stop(const char *applet, const char *exec, const char *const *argv,
int run_stop_schedule(const char *applet, int run_stop_schedule(const char *applet,
const char *exec, const char *const *argv, const char *exec, const char *const *argv,
pid_t pid, uid_t uid, pid_t pid, uid_t uid,
bool test, bool progress); bool test, bool progress, bool quiet);
#endif #endif

View File

@ -657,7 +657,7 @@ int main(int argc, char **argv)
else else
parse_schedule(applet, NULL, sig); parse_schedule(applet, NULL, sig);
i = run_stop_schedule(applet, exec, (const char *const *)margv, i = run_stop_schedule(applet, exec, (const char *const *)margv,
get_pid(applet, pidfile), uid, test, progress); get_pid(applet, pidfile), uid, test, progress, false);
if (i < 0) if (i < 0)
/* We failed to stop something */ /* We failed to stop something */

View File

@ -755,7 +755,7 @@ int main(int argc, char **argv)
if (exiting) { if (exiting) {
syslog(LOG_INFO, "stopping %s, pid %d", exec, child_pid); syslog(LOG_INFO, "stopping %s, pid %d", exec, child_pid);
nkilled = run_stop_schedule(applet, exec, NULL, child_pid, nkilled = run_stop_schedule(applet, exec, NULL, child_pid,
0, false, false); 0, false, false, true);
if (nkilled > 0) if (nkilled > 0)
syslog(LOG_INFO, "killed %d processes", nkilled); syslog(LOG_INFO, "killed %d processes", nkilled);
} else { } else {