scron

simple cron daemon
git clone git://git.2f30.org/scron
Log | Files | Refs | README | LICENSE

commit 3d6233c776e52fea9c4cb44a6ff1485d7e75f45b
parent 3f9c79ec1592532c2d17747e8de26d3010600239
Author: sin <sin@2f30.org>
Date:   Thu,  3 Jul 2014 10:11:15 +0100

Also report if the job was terminated by a signal

Diffstat:
Mcrond.c | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/crond.c b/crond.c @@ -139,8 +139,17 @@ waitjob(void) t = time(NULL); while ((pid = waitpid(-1, &status, WNOHANG | WUNTRACED)) > 0) { + if (WIFSIGNALED(status) == 1) { + printf("complete: pid: %d terminated by signal: %d time: %s", + pid, WTERMSIG(status), ctime(&t)); + fflush(stdout); + if (dflag == 1) + syslog(LOG_INFO, "complete: pid: %d terminated by signal: %d", + pid, WTERMSIG(status)); + return; + } if (WIFEXITED(status) == 1) { - printf("complete: pid %d, return: %d time: %s", + printf("complete: pid: %d, return: %d time: %s", pid, WEXITSTATUS(status), ctime(&t)); fflush(stdout); if (dflag == 1)