1and1 Cron Job – Crontab Cronjob Examples
Cron jobs help you automate procedures such as backups, executing a file or sending an email. This page is a quick reference for creating a cron entry that defines when a specific application or script should execute.
Type “crontab -e” to edit your cron file. If you just want a listing, use “crontab -l” and if you want to delete a cron job, simply type “crontab -r”.
A line within a cron file will look like this:
1 2 3 4 5 /etc/myScript arguments
There are five numbers at the start of each line and represent the following:
1: minutes (0-59)
2: Hours (0-23)
3: Day (0-31)
4: Month (0-12 or January, February, … 0 and 12=December)
5: Day of the week(0-7 or Monday, Tuesday, Wednesday, … 0 and 7=Sunday)
You can also customize the commands even further, sor example:
*: applies everytime
1-4: start if 1,2,3 or 4 matche
1-4/2 step-by-step, here: 1 and 3
1,5,6: enumeration
*/3: every third
1-4,10-15: enummeration and range combined
To define the SHELL you would like to have execute and who you want to email the results to, use these commands:
SHELL=/bin/bash
MAILTO=myname@myhost
Cron Job – More Examples
# every day at 0:05
5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
# every first day of the month at 14:15
15 14 1 * * $HOME/bin/monthly
# on weekdays at 22:00
0 22 * * 1-5 mail -s “Adsense UP!” ken%Ken,%%Go buy something!%
# every day 23 minutes after every even hour (0:23, 2:23, …)
23 0-23/2 * * * $HOME/report.sh
# Sundays at 4:05
5 4 * * sun $HOME/backup1.sh full
# Every other day at 1:05am
5 1 */2 * * wget -q http://www.monetizers.com/adsense_clicklogger.php?R=
5 Responses to “1and1 Cron Job – Crontab Cronjob Examples”
Comments
Read below or add a comment...
Thanks for the info! I’m new at Cron jobs.
my script tells me I have to run this cron job:
*/30 * * * * /web/cgi-bin/php/bin -f /home/content/a/f/c/afcads/html/safelist/admin/cron/cron_queue.php efa2055da0189f307e7a0b0582ad7030
my path to php is this: web/cgi-bin/php/bin
here is the information on how to run cron jobs on my server: help. securepaynet. net/article/3483?pl_id=422628
My question is where do I put the efa2055da0189f307e7a0b0582ad7030 when the cron jobs has to look like this:
/web/cgi-bin/php5 “$HOME/html/safelist/admin/cron/cron_queue.php”
I think the line would be:
/web/cgi-bin/php5 “$HOME/html/safelist/admin/cron/cron_queue.php” efa2055da0189f307e7a0b0582ad7030
So just all after each other.
The code appears to be nothing else than a parameter for the cron+queue.php script, just like the $HOME/…php is a parameter to the php5 executable
sir plg send me contab set only terminal tty4
You can use parentheses to club together a set of commands to execute
* */12 * * * (cd /array/purato/scripts; ./compute_storage.sh 1>/dev/null )