Monday, October 22, 2012

cron Has No Limit in Linux

cron in Solaris limits the number of cron jobs it can run by the configuration defined in /etc/cron.d/queuedefs.

In Ubuntu (or Linux), it does not have this limitation. I downloaded (apt-get source cron) the source and could not find any hard limit coded in the program. Also, I tried to launch some long running job (sleep 36000000) every minute and managed to pump 1500+ jobs until my little netnook (with 1GB ram) started swapping.

Although the hardware is the limit for cron, it would be nice to monitor how many cron jobs are running and how long each cron job takes to run. According to the 'man cron', you can provide a '-L' flag to capture more info of a job

-L loglevel
               Tell  cron what to log about jobs (errors are logged regardless
               of this value) as the sum of the following values:

                   1      will log the start of all cron jobs

                   2      will log the end of all cron jobs

                   4      will log all failed jobs (exit status != 0)

                   8      will log the process number of all cron jobs

For troubleshooting of cron, this link (Reasons Why Crontab Does Not Work) is realy useful.


Post a Comment

<< Home