Questions tagged [cron]

Cron is a time-based job scheduler in Unix-like computer operating systems. Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates.

For information about the most common cron issues and how to fix them, see Why is my crontab not working and how can I troubleshoot it.

1957 questions
22
votes
3 answers

How do I use curl in a cron job?

I need to set up a cron job in cpanel that calls a URL (on the same server) once a week. I was going to use wget but it turns out this is disabled on the shared server being used. Is there an alternative to wget? I've heard that curl can be used but…
davidhyland
  • 335
  • 1
  • 2
  • 4
21
votes
3 answers

Crontab schedule in different timezones

I would like to schedule my tasks in EST but I want the actual task to run under the default system timezone. Whats the best way of doing this?
DD.
  • 3,114
  • 11
  • 35
  • 50
21
votes
4 answers

Running cron every 10 minutes

I have a python script on my desktop: /home/ceasor/Desktop/script.py In /etc/crontab, I wrote: 0 */2 * * * ceasor sudo python /home/ceasor/Desktop/script.py The python script is not getting run. How do I run cron every 10 minutes?
ceasor
20
votes
5 answers

APT FATAL -> Failed to fork

I saw a lot of questions regarding this, but mine seems a little different. Here's what I receive: /etc/cron.weekly/apt-xapian-index: FATAL -> Failed to fork. run-parts: /etc/cron.weekly/apt-xapian-index exited with return code…
MultiformeIngegno
  • 1,687
  • 9
  • 26
  • 31
20
votes
3 answers

Cron expression: difference between 0/1, 1/1 and *

In a cron expression, what is the difference between 0/1, 1/1 and * ?
sdabet
  • 313
  • 1
  • 2
  • 10
20
votes
1 answer

What cron job is /usr/lib/sa/sa1

I have logwatch enabled for my machine. Suddenly I see this line in my logwatch /usr/lib64/sa/sa1 1 1 : 4297 times /usr/lib64/sa/sa2 -A : 29 times run-part /etc/cron.hourly : 716 I tried crontab -e but I dont see any entries?
biz14
  • 381
  • 1
  • 3
  • 10
20
votes
9 answers

script to automatically test if a web site is available

I'm a lone web developer with my own Centos VPS hosting a few small web sites for my clients. Today I discovered my httpd service had stopped (for no apparent reason - but that's another thread). I restarted it but now I need to find a way that I…
Xoundboy
  • 603
  • 1
  • 10
  • 21
19
votes
2 answers

Is there a utility like cron, that schedules a job for later (but only once)?

I'm trying to design a program that sends a text when a certain (non-periodic) event occurs. Right now, I'd like a script that finds when this event occurs, and then schedules a (cron-like) job that will send a text just before that even occurs. A…
user1209326
  • 301
  • 1
  • 4
19
votes
5 answers

How do I use crontab to start a screen session?

I want to create a crontab entry so that it starts screen, starts a gameserver and detaches. This is for in case the server is rebooted and I want it to automatically start this for me. 0 0 0 0 0 (command) should run upon startup. It runs a shell…
Victor
  • 371
  • 1
  • 3
  • 9
19
votes
4 answers

How to run a cron job only once?

I have a job which runs forever the moment it starts. So i want to start it only once after entering it into "crontab -e" file and saving it (or) whenever reboot happens. How to achieve this?
Rama Vadakattu
  • 195
  • 1
  • 1
  • 6
18
votes
3 answers

How do you set a DATE variable to use in a log for crontab output?

I was playing aroudn with some variations of date like DATE = $(date) but that didnt work either crontab -e CRONLOG=/tmp/log/crontab.log DATEVAR=`date +20\%y\%m\%d_\%H\%M\%S` * * * * * echo $DATEVAR >> /tmp/log/crontab.log */2 * * * * echo…
qodeninja
  • 2,753
  • 10
  • 32
  • 33
18
votes
5 answers

Why is only one wget command working in my crontab?

I wish to fetch content from a PHP script on my server two times a day, altering a query variable lang to set what language we want, and save this content in two language specific files. This is my crontab: */15 * * * * ~root/apache.sh >…
Alexander Wallin
  • 283
  • 1
  • 2
  • 7
18
votes
2 answers

User-specific anacrontab?

I can use crontab -e as a normal user to edit my user crontab. Does anacron have any similar feature for individual non-admin users, or does it only have a system-wide anacrontab?
Ryan C. Thompson
  • 489
  • 5
  • 12
18
votes
11 answers

Is it safe to run apt-get update every night?

Is it safe to run apt-get update -y through cron on a production server?
Miko
  • 1,759
  • 4
  • 22
  • 28
17
votes
3 answers

How to send an e-mail after a cron job

I have added a cron job for my incremental backup, and I configured it like this: 0 23 * * * /usr/bin/rsync -ravzX /mnt/external/project/ /media/backup/project/ | mail -s "Backup Success" admin@example.com But i didn't receive any e-mails. How can I…
Booth
  • 488
  • 2
  • 4
  • 11