scron

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

commit 7d8ab0e141ca770c25a5975271d581a40db35da8
parent cf37a7108e6127cbb712821c960393de89c4dcfd
Author: sin <sin@2f30.org>
Date:   Wed,  2 Jul 2014 14:02:00 +0100

Remember to flush stdout

Diffstat:
Mcrond.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/crond.c b/crond.c @@ -112,6 +112,7 @@ runjob(char *cmd) syslog(LOG_WARNING, "error: failed to fork job: %s", cmd); } else if (pid == 0) { printf("run: %s pid: %d time: %s", cmd, getpid(), ctime(&t)); + fflush(stdout); syslog(LOG_INFO, "run: %s pid: %d", cmd, getpid()); execl("/bin/sh", "/bin/sh", "-c", cmd, (char *) NULL); fprintf(stderr, "error: job failed: %s time: %s\n", cmd, ctime(&t)); @@ -131,6 +132,7 @@ waitjob(void) while ((pid = waitpid(-1, &status, WNOHANG | WUNTRACED)) > 0) { printf("complete: pid %d, return: %d time: %s", (int) pid, status, ctime(&t)); + fflush(stdout); syslog(LOG_INFO, "complete: pid: %d return: %d", (int) pid, status); } }