Ubuntu: start cron service with supervisor



Question:

I have the following in my supervisord.conf:

[program:cron]  command=service cron start  autostart=true  autorestart=false  stderr_logfile=/var/log/cron.err.log  stdout_logfile=/var/log/cron.out.log  

Seems like it's failing?:

root@srv:/# supervisorctl  cron                             FATAL     Exited too quickly (process log may have details)  

However it's running:

root@srv:/# ps aux | grep cron  root        52  0.0  0.1  26068  2464 ?        Ss   13:07   0:00 /usr/sbin/cron  root      3053  0.0  0.0  11284   936 ?        S+   13:08   0:00 grep --color=auto cron  

Am I starting cron correctly with supervisor?


Solution:1

Possible to run cron in foreground?

command=service cron start  

Should be instead:

command=cron -f  


Solution:2

With supervisor the program you want to run, needs to stay on the foreground. You start cron as a service, so the program exits, and supervisor sees it as it stopped.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »