Archive for May 31st, 2019

What is Crontab?
Before I answer that question, I will introduce with a linux application called cron. Cron is a daemon (program that runs behind the scene) to execute scheduled commands (Vixie Cron). In another word, cron is an automated time based script execution. Cron is started automatically from /etc/init.d on entering multi-user runlevels. Cron is commonly used for automating system maintenance or administration jobs that may need to run periodically. The term of Cron Jobs is referred from Cron task or jobs.

Any programs that we put in the task scheduler will be placed in a file named ‘crontab file‘.
Cron wakes up every minute to examine all stored crontabs and checking each command to see if it should be run in the current minute.
In this tutorial, I use Linux Ubuntu 11.10.

Let’s check the file. Go to /etc directory and search the file.

$ ls -l crontab
-rw-r--r-- 1 root root 723 2019-05-27 23:11 crontab
$ cat crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.


# m h dom mon dow user command
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 )

This is the content of my cron file. As you can see, there are 4 cron jobs in my crontab file.

Read Full Post »