dcron
dcron copied to clipboard
A way to output a job's output to stdout?
That would be most welcome for running dcron
in a docker container. Then there'd no need to set up mail, and docker logs
could be used to inspect what's going on.
@x-yuri , I have the same issue, did you find a way to output job's output to stdout? Or are you using another cron?
@ttionya I didn't find a way to make dcron
output to stdout. I've found slicd
, which is an old unsupported piece of software, but it works. There's also this gist, but I'm not sure if it works. UPD Oh, there's my comment there, so supposedly it does, but with rsyslog
.
...And even under Alpine Linux w/o rsyslog
.
Actually, even with dcron
it seems to work under Alpine Linux.
Also looking for a way to achieve this, possibly without any extra software. I don't see the point of installing and configuring a mail server just for logging the output of a couple scripts, it's easier and more practical to have all the logs in one place
@x-yuri , Thanks for the quick reply, I saw your reply a few hours ago but I was in a hurry to go to the hospital so I didn't reply in time.
My current cron configuration is * * * * * bash xxx.sh > /dev/stdout
, but there is no output from dcron (busybox cron works fine), I will try to change it to /proc/1/fd/1
and test if it works.
My requirement is simple, execute the script regularly and docker logs
can see the stdout of the script. I think it's a good idea to write the stdout of the script to a file and start crond in the background, and docker's entrypoint executes tail -f
to listen for changes in the contents of the file. I'll try it out and post the results here later.
I'll try it out and post the results here later.
Both methods, > /proc/1/fd/1
and redirecting the output file to a file and then reading the contents of the file via tail -f
will print the stdout of the script properly. @x-yuri @KingDuckZ
I would choose /proc/1/fd/1
because it is very simple.
Thanks but I switched to cronie and configured it to run with -s -m off
which does just what I want