UNIX Job scheduling with cron and at

Running jobs at regular intervals is managed by the cron facility, which consists of the crond daemon and a set of tables describing what work is to be done and with what frequency. The daemon wakes up every minute and checks the crontabs to determine what needs to be done. Users manage crontabs using the crontab command. The crond daemon is usually started by the init process at system startup.
To create a crontab, you use the crontab command with the -e (for "edit") option. This opens the vi editor unless you have specified another editor in the EDITOR or VISUAL environment variable.
Or edit the /var/spool/cron/[user] file directly.

Each crontab entry contains six fields:

  1. Minute
  2. Hour
  3. Day of the month
  4. Month of the year
  5. Day of the week
  6. String to be executed by sh
A simple crontab example
0,30 22-24 * 7 fri-sat /home/bang/mycronjob.sh
In this example, our command is executed at the 0th and 30th minutes (every 30 minutes), for the hours between 10 P.M. and midnight on Fridays and Saturdays during July.
By default cron jobs sends a email to the user account executing the cronjob. If this is not needed put the following command At the end of the cron job line .
>/dev/null 2>&1
The crontab file is often stored in /var/spool/cron/[user].
Log directories: /var/log/, /usr/local/logs/
To print the history report for the cron job mycronjob.sh
cd /var/log
cat cron* | grep "mycronjob.sh" | awk '{print $1,$2,$3,$8}'
Sometimes you may need to run a job just once, rather than regularly. For this you use the at command. The commands to be run are read from a file specified with the -f option, or from stdin if -f is not used. The -m option sends mail to the user even if there is no stdout from the command. The -v option displays the time at which the job will run before reading the job. The time is also displayed in the output.