mrwhite
mrwhite

Reputation: 105

How to update the crontab and check if its running correctly?

I've modified the crontab with:

sudo crontab -e

and added a cron for a script to run every minute so I can test if it works:

1 * * * * /scripts/backup-script.sh > /scripts/backup-script.logs

Afterwards, I tried to restart the cron service to restart the server but the cron doesn't seem to be working, I tried to use:

crontab -l

and it appears to have the old content as if I didnt even modify it. However, going into crontab -e does show the updated content.

Upvotes: 0

Views: 1806

Answers (1)

Romeo Ninov
Romeo Ninov

Reputation: 7235

To make your script run every minute your cron record must be:

* * * * * /scripts/backup-script.sh > /scripts/backup-script.logs

What you enter will run every 1st minute every hour

And if you add record via crontab command you do not need to touch cron daemon

To see the cron record you add with sudo crontab -e you must check it with command sudo crontab -l. Otherwise you list cron record of different user

Upvotes: 1

Related Questions