diff options
Diffstat (limited to 'service.c')
-rw-r--r-- | service.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/service.c b/service.c index 23d1de9..3246fef 100644 --- a/service.c +++ b/service.c @@ -114,24 +114,24 @@ err: void serviceStatus(struct Service *service) { if (service->state == Stop && service->intent == Stop) { - syslog(LOG_INFO, "%s[] is stopped", service->name); + syslog(LOG_NOTICE, "%s[] is stopped", service->name); } else if (service->state == Stop && service->intent == Start) { struct timespec now, timeleft; clock_gettime(CLOCK_MONOTONIC, &now); timespecsub(&service->restartDeadline, &now, &timeleft); syslog( - LOG_INFO, "%s[] is restarting in %lds", + LOG_NOTICE, "%s[] is restarting in %lds", service->name, (long)timeleft.tv_sec ); } else if (service->state == Stop && service->intent == Restart) { - syslog(LOG_INFO, "%s[] is restarting", service->name); + syslog(LOG_NOTICE, "%s[] is restarting", service->name); } else if (service->state == Start && service->intent == Start) { - syslog(LOG_INFO, "%s[%d] is started", service->name, service->pid); + syslog(LOG_NOTICE, "%s[%d] is started", service->name, service->pid); } else if (service->state == Start && service->intent == Stop) { - syslog(LOG_INFO, "%s[%d] is stopping", service->name, service->pid); + syslog(LOG_NOTICE, "%s[%d] is stopping", service->name, service->pid); } else if (service->state == Start && service->intent == Restart) { syslog( - LOG_INFO, "%s[%d] is stopping for restart", + LOG_NOTICE, "%s[%d] is stopping for restart", service->name, service->pid ); } @@ -159,11 +159,11 @@ void serviceStart(struct Service *service) { service->intent = Start; service->pid = fork(); if (service->pid < 0) { - syslog(LOG_ERR, "fork: %m"); + syslog(LOG_WARNING, "fork: %m"); return; } if (service->pid) { - syslog(LOG_INFO, "%s[%d] started", service->name, service->pid); + syslog(LOG_NOTICE, "%s[%d] started", service->name, service->pid); service->state = Start; return; } @@ -204,7 +204,7 @@ void serviceSignal(struct Service *service, int signal) { int error = kill(service->pid, signal); if (error) { syslog( - LOG_ERR, "kill(%s[%d], %s): %m", + LOG_WARNING, "kill(%s[%d], %s): %m", service->name, service->pid, sys_signame[signal] ); } @@ -224,28 +224,28 @@ void serviceRestart(struct Service *service) { } } -static void serviceLog(struct Service *service, int pri, const char *log) { - syslog(pri, "%s[%d]: %s", service->name, service->pid, log); +static void serviceLog(struct Service *service, const char *log) { + syslog(LOG_NOTICE, "%s[%d]: %s", service->name, service->pid, log); } void serviceRead(struct Service *service) { const char *out; while (NULL != (out = lineRead(&service->outLine, service->outPipe[0]))) { - serviceLog(service, LOG_INFO, out); + serviceLog(service, out); } - if (errno != EAGAIN) syslog(LOG_ERR, "read: %m"); + if (errno != EAGAIN) syslog(LOG_WARNING, "read: %m"); const char *err; while (NULL != (err = lineRead(&service->errLine, service->errPipe[0]))) { - serviceLog(service, LOG_NOTICE, err); + serviceLog(service, err); } - if (errno != EAGAIN) syslog(LOG_ERR, "read: %m"); + if (errno != EAGAIN) syslog(LOG_WARNING, "read: %m"); } static void serviceFlush(struct Service *service) { const char *out = lineFlush(&service->outLine); const char *err = lineFlush(&service->errLine); - if (out) serviceLog(service, LOG_INFO, out); - if (err) serviceLog(service, LOG_NOTICE, err); + if (out) serviceLog(service, out); + if (err) serviceLog(service, err); } void serviceReap(pid_t pid, int status) { @@ -285,11 +285,11 @@ void serviceReap(pid_t pid, int status) { // TODO: Determine if restart interval should be reset? setDeadline(service); syslog( - LOG_INFO, "%s[%d] restarting in %lds", + LOG_NOTICE, "%s[%d] restarting in %lds", service->name, pid, (long)service->restartInterval.tv_sec ); } else { - syslog(LOG_INFO, "%s[%d] stopped", service->name, pid); + syslog(LOG_NOTICE, "%s[%d] stopped", service->name, pid); } if (service->intent == Restart) { serviceStart(service); |