How do I set up a cronjob?

Via the "crontab" command from the shell.

crontab -l will show you your currently set up cronjobs on the server.

crontab -r will delete your current cronjobs.

crontab -e will allow you to add or edit your current cronjobs by using your default text editor to edit your "crontab file".

Your crontab includes all the cron jobs you'd like, with one cron entry per line. A cron entry looks like this:

45 2 * * * /home/user/script.pl


The first number is the minute of the hour for the command to run on. 
The second number is the hour of the day for the command to run on. 
The third number is the day of the month for the command to run on. 
The fourth number is the month of the year for the command to run on. 
The fifth number is the day of the week for the command to run on. 
Here are some examples to help you learn the syntax for the numbers: 

24 * * * * : will be run every hour on the 24nd minute. 
8,45 * * * * : will be run twice an hour on the 8th and 45th minutes. 
*/15 */2 * * *: will be run at 0:00, 0:15, 0:30, 0:45, 2:00, 2:15, 2:30, ... 
31 18 * * 7: will be run at 6:31pm every Sunday. 
  • 0 gebruikers vonden dit artikel nuttig
Was dit antwoord nuttig?

Gerelateerde artikelen

How do I launch SSH or Shell Access tools?

Overview SSH (Secure Shell) is a program to log into another computer/server over a network...

What are some commonly used UNIX shell commands?

Creating a Directory   You can create a directory by using the mkdir command. For example, to...

How do I find information on other UNIX commands?

The UNIX command line interface is wonderful. With that power comes complexity if only in the...

How do I create a symbolic link?

A symbolic link is a pointer to another file or directory. It can be used just like the original...

How do I create a tar archive of a directory?

A common task in UNIX operating systems is creating an archive of many files or directories in a...