diff options
author | William Hubbs <w.d.hubbs@gmail.com> | 2018-12-18 11:29:10 -0600 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2018-12-18 11:29:26 -0600 |
commit | d5c396cbfc49ce88f58d944c8ab01d2c36ccdc7b (patch) | |
tree | 01f3ab4138e7e4fe4cb142b0dd7616456059b5a4 | |
parent | 5427783fdf3d183ea4e63afc507c31d88f0d2c9c (diff) |
Add debug logging to start-stop-daemon and rc-supervisor
This will make it easier to track down why the supervisor intermittently
hangs after it runs for a long time.
-rw-r--r-- | src/rc/rc-schedules.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/rc/rc-schedules.c b/src/rc/rc-schedules.c index 84c7ea18..167e5eb4 100644 --- a/src/rc/rc-schedules.c +++ b/src/rc/rc-schedules.c @@ -28,6 +28,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <syslog.h> #include <time.h> #include <unistd.h> #include <sys/stat.h> @@ -270,8 +271,11 @@ 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 { - if (!quiet) - ebeginv("Sending signal %d to PID %d", sig, pi->pid); + if (sig) { + syslog(LOG_DEBUG, "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); @@ -279,6 +283,9 @@ int do_stop(const char *applet, const char *exec, const char *const *argv, eendv(killed ? 0 : 1, "%s: failed to send signal %d to PID %d: %s", applet, sig, pi->pid, strerror(errno)); + else if (!killed) + syslog(LOG_ERR, "Failed to send signal %d to PID %d: %s", + sig, pi->pid, strerror(errno)); if (!killed) { nkilled = -1; } else { @@ -310,12 +317,18 @@ int run_stop_schedule(const char *applet, if (!(pid > 0 || exec || uid || (argv && *argv))) return 0; - if (exec) + if (exec) { einfov("Will stop %s", exec); - if (pid > 0) + syslog(LOG_DEBUG, "Will stop %s", exec); + } + if (pid > 0) { einfov("Will stop PID %d", pid); - if (uid) + syslog(LOG_DEBUG, "Will stop PID %d", pid); + } + if (uid) { einfov("Will stop processes owned by UID %d", uid); + syslog(LOG_DEBUG, "Will stop processes owned by UID %d", uid); + } if (argv && *argv) { einfovn("Will stop processes of `"); if (rc_yesno(getenv("EINFO_VERBOSE"))) { |