erdl / server

A collection of scripts, documentation and to-dos associated to ERDL Servers.
0 stars 0 forks source link

Need to run cron jobs at any interval in time. #6

Closed ryantanaka closed 6 years ago

ryantanaka commented 6 years ago

We need to be able to run cron jobs at any time periods (5 min, 10 min, etc..).

ryantanaka commented 6 years ago

Using the /etc/crontab file, we can run cronjobs at the 5 minute level by using the following settings as shown on the last line:

17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

*/5 *   * * *   root    /home/ryan/Programming/test_cron_job/cron.py >> /home/ryan/Programming/test_cron_job/system_cron_job_output.txt

The /{NUMBER} symbol represents the time step. For example iff we need to do every 10 minutes instead, */10 can be used.

I'll elaborate a bit more on this in the wiki regarding crontabs.