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,
const char *exec, const char *const *argv,
pid_t pid, uid_t uid,
bool test, bool progress)
bool test, bool progress, bool quiet)
{
SCHEDULEITEM *item = TAILQ_FIRST(&schedule);
int nkilled = 0;
@ -409,10 +409,11 @@ int run_stop_schedule(const char *applet,
if (progressed)
printf("\n");
if (nrunning == 1)
eerror("%s: %d process refused to stop", applet, nrunning);
else
eerror("%s: %d process(es) refused to stop", applet, nrunning);
if (! quiet)
if (nrunning == 1)
eerror("%s: %d process refused to stop", applet, nrunning);
else
eerror("%s: %d process(es) refused to stop", applet, nrunning);
return -nrunning;
}

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,
const char *exec, const char *const *argv,
pid_t pid, uid_t uid,
bool test, bool progress);
bool test, bool progress, bool quiet);
#endif

View File

@ -657,7 +657,7 @@ int main(int argc, char **argv)
else
parse_schedule(applet, NULL, sig);
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)
/* We failed to stop something */

View File

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