Create a text file in your /home folder called “cronjobs.txt”
Open it and add a line for each job you want to run:
0 * * * * /usr/bin/unison
0 */5 * * * /usr/bin/cleanup
The first line will run unison every hour, while the second line will run a process called cleanup every 5 hours.
After saving the file run
crontab -u USERNAME cronjobs.txt
where USERNAME is your username.
You can verify that the cronjob is added successfully by running:
crontab -l
Each line is the cronjob file has the following syntax:
minutes(0-59) hours(0-23) day(0-27/28/29/30) month(0-11) weekday(0-6) command
A star for any of the above means any, so 0 * * * * means every hour of every day on minute 0, which is an hourly job
*/5 means every fifth, */2 every second etc, so */5 * * * * would mean every 5th minute of every hour of every day, which is a job that repeats every five minutes.
Recent Comments