Leave a comment

Steps to Setup Cron Job

Installations:

Ubuntu:

$udo apt-get update

$sudo apt-get install cron

Path: /etc/cr

Files: /etc/cron.daily, /etc/cron.hourly, /etc/cron.monthly or /etc/cron.weekly.

To edit Cron Job:

$ crontab -e     #looks like  Installing crontab

Output Like Below:

crontab -e

no crontab for root – using an empty one

Select an editor.  To change later, run ‘select-editor’.

1. /bin/ed

2. /bin/nano        <—- easiest

3. /usr/bin/vim.tiny

To Check Active Cron Jobs:

$ crontab -l

Examples: * * * * * /cron/run >/dev/null 2>&1  //every minute every day

min (0 – 59)

hour (0 – 23)

day of month (1 – 31)

month (1 – 12)

day of week (0 – 6) (Sunday=0)

command /script/file/etc    //cron/run >/dev/null 2>&1

Logs :

grep cron /var/log/syslog

Live Log Activity:

tail -f /var/log/syslog | grep cron

Cron Job  verificaton: https://crontranslator.appspot.com/

Leave a Reply

Your email address will not be published. Required fields are marked *