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
29
votes
4 answers

What could cause "Permission denied" for command `crontab -e`?

Here's some output that I hope is helpful: nick@home-sv-1:~$ crontab -e /var/spool/cron/crontabs/nick: Permission denied nick@home-sv-1:~$ echo $EDITOR emacs nick@home-sv-1:~$ ls /var/spool/cron/crontabs ls: cannot open directory…
Nick Bolton
  • 5,126
  • 12
  • 54
  • 62
29
votes
1 answer

What's the difference between /etc/cron.d and /var/spool/cron?

The crontabs on RHEL seem to be duplicated in two places, /etc/cron.d, and /var/spool/cron. I've checked, and neither of these are simlinks to the other, and neither are any of the crons contained in either location. I guess my most important…
Bart B
  • 3,457
  • 6
  • 31
  • 42
28
votes
2 answers

Crontab maximum command length

Is there a limit of characters a command in a crontab could be ? I have a crontab with a 178 characters command and it seems to be truncated at 164 when executed. I can tell this number from the e-mail I receive and from the vi colors changing from…
Ponytech
  • 934
  • 1
  • 7
  • 14
27
votes
5 answers

Crond offset five minute schedule

Is it possible to offset a cron script set to run every 5 minutes? I have two scripts, script 1 collects some data from one database and inserts it into another, script 2 pulls out this data and a lot of other data and creates some pretty reports…
user80776
26
votes
2 answers

Weird syslog order

Have you ever seen wrong order in /var/log/syslog ? I think that it causes only crontab. Jun 28 22:20:01 alex CRON[2327]: (root) CMD (something > /dev/null) Jun 28 22:21:01 alex CRON[2700]: (root) CMD (something > /dev/null) Jun 21 03:49:01 alex…
Tomasz
  • 371
  • 3
  • 7
26
votes
2 answers

How to configure cron job to run every 2 days at 11PM

I have a centos server and I want to run a job on it at 11PM every 2 days, how do I do that?
fred basset
  • 665
  • 2
  • 7
  • 14
25
votes
2 answers

cron: can't lock /var/run/crond.pid, otherpid may be 3759

I had a cron job setup that I cleared using cron -r last night. This morning I tried to enable it again and get this error each time: cron: can't lock /var/run/crond.pid, otherpid may be 3759: Resource temporarily unavailable I have tried rebooting…
Zaid
25
votes
4 answers

How precise is a cron daemon?

Is the cron job scheduler really precise? I mean, I need a script to run every night the latest possible, BUT before 00:00 of the next day. I'd ideally run a cron job at 23.59 (or 11:59 pm), but will the system be really precise? Since a second does…
user310317
25
votes
12 answers

Techniques to Monitor cron tasks?

Are there good techniques for monitoring cron tasks over a cluster? We're starting to use cron to launch tasks at daily intervals. A few ideas for checking out information: Add special application handling that logs information into some "network…
Tristan Juricek
  • 101
  • 1
  • 3
  • 6
24
votes
4 answers

OSX mojave: "crontab: tmp/tmp.X: Operation not permitted"

After updating my OSX to Mojave, it seems I am no longer able to edit my crontab. Any attempt to do so results in the error message on the title of this question. I tracked crontab to /private/var/at and the permissions are the same as another…
Joao Encarnacao
  • 343
  • 1
  • 2
  • 4
24
votes
1 answer

Getting cron logs to add to file, not override it

First, I'm sorry if this is the wrong stackexchange for this, but it seemed like the right one. This is my crontab right now: MAILTO=****@gmail.com 10,30,50 * * * * ~/webapps/****/apache2/bin/start */10 * * * * /usr/local/bin/python2.7…
sinθ
  • 371
  • 1
  • 2
  • 6
24
votes
7 answers

How to use my aliases in my crontab?

I have some commands in my .profile that I want to invoke from my crontab. For example, if I have, alias notify-me="~/bin/notify.pl -u user1" alias notify-team="~/bin/notify.pl -u user1 user2 user3 user4 ...." I'd like to just invoke the alias 0…
Keith Bentrup
  • 719
  • 3
  • 8
  • 19
22
votes
5 answers

Execute rsync command over ssh with an ssh agent via crontab

i have a cronjob: 0 9 * * * rsync -a mydir remote_machine: i installed this with 'crontab -e'. i have an ssh-agent running, and when i execute the rsync command itself it works w/o any user interaction or password entry, but the cronjob fails with…
aaron
  • 741
  • 3
  • 10
  • 19
22
votes
5 answers

Adding file to /etc/cron.d doesn't make it run (ubuntu 10.04)

If I scp a cron file into /etc/cron.d it doesn't run unless I edit the file and change the command. Then crond seems to pick up the cron file. How can I make cron reload its cron files in ubuntu 10.04? 'touch'ing the file doesn't work nor does…
tom
  • 333
  • 2
  • 4
  • 7
22
votes
3 answers

Override MAILTO for a single crontab entry

We have a role account at work that has a pretty big crontab. Its MAILTO is pointed at a shared address, so that a number of us get notified if something fails. I'd like to add an entry to this crontab, but I only want myself to be notified if…
mike
  • 3,963
  • 11
  • 30
  • 27