Today we will talk about cron jobs.
You can run cron jobs once a day, once a week, one a month or even a few minutes. Next we will see how to install the cron job.
First you have to run # crontab -e
In the file opened you must append
*/5 * * * * /path/to/script
For example this will execute your script every 5 minutes
* * * * * /path/to/script
– this will execute script at every minute
the first * represents minute
the second * represents hour
the third * represents day from month
the fourth * represents month
the fifth * represents day from week
Usualy if you want to execute a script you must make it executable. You can do this with this command
chmod +x filename.sh
If you need to see all cron jobs you must use this command
# crontab -l
Or you can see cron jobs only for a specific user
# crontab -u username -l
If you want to remove cronjobs you can use
crontab -r
– remove current cron job