Setting Up Cron Job

 

Created on: 10/15/19
Last update: 10/15/19

Specify editor

Specify nano as editor:

export VISUAL=nano; crontab -e

Specify vim as editor:

export VISUAL=vim; crontab -e

Basic rules

minute hour day_of_month month day_of_week
0 3 * * *

The cron schedule expressions can be tested at https://crontab.guru/

Example

Basic cron jobs

Daily job running at 3A.M.:

0 3 * * * bash /SMAP_PROGRAM/daily/_updateSmapDaily.sh >> /SMAP_PROGRAM/log/updatedaily.log 2>/SMAP_PROGRAM/log/updatedaily.err

Weekly job running at 4A.M. on every Saturday:

0 4 * * 6 bash /SMAP_PROGRAM/weekly/_updateSmapWeekly.sh >> /SMAP_PROGRAM/log/updateweekly.log 2>/SMAP_PROGRAM/log/updateweekly.err