crontab repeats itself

crontab repeats itself

Posted by: wu1
Posted on: 2006-07-31 03:55:00

I'm having a strange experience running a very simple command with crontab. Here is the entry:

5,25,45 * * * * /usr/bin/uptime >> /home/user/mydomain.com/cpuload.txt

So basically, it dumps the output of uptime every 20 minutes. However, in cpuload.txt, I get this:

02:05:01 up 2 days, 12:06, 3 users, load average: 0.96, 0.74, 0.57
02:05:03 up 2 days, 12:06, 3 users, load average: 0.96, 0.74, 0.57
02:05:59 up 2 days, 12:07, 3 users, load average: 0.62, 0.68, 0.56
02:25:01 up 2 days, 12:26, 3 users, load average: 0.35, 0.38, 0.40
02:45:01 up 2 days, 12:46, 3 users, load average: 1.00, 0.73, 0.59
03:05:00 up 2 days, 13:06, 3 users, load average: 0.32, 0.49, 0.59
03:25:01 up 2 days, 13:26, 2 users, load average: 1.09, 0.82, 0.88
03:26:01 up 2 days, 13:27, 2 users, load average: 0.67, 0.75, 0.85
03:45:01 up 2 days, 13:46, 2 users, load average: 0.47, 0.57, 0.65

Notice the command was executed three times at the top, and twice at 13:25. Any ideas why it's doing this? I tried putting the command into a .sh file to no avail.

Any input appreciated, thank you.

Re: crontab repeats itself

Posted by: gordaen
Posted on: 2006-07-31 09:40:00

Your cron entry looks fine and running the command alone works fine for me. I added the entry to mine to see if anything funky happens for me (my other entries are once-a-day and haven't had problems). What machine are you on?

Check out Gordaen's Knowledge, the blog, and the MR2 page.

Re: crontab repeats itself

Posted by: norm1037
Posted on: 2006-07-31 09:48:00

Try replacing /usr/bin/uptime with /usr/bin/w and see if you get the same results. You may get some additional text thrown in but see if you get the triplicates. Try running /usr/bin/uptime from the command line to check for any hard soft links.


--
Norm


Opinions are my own views, not DreamHosts'.
I am NOT a DreamHost employee OK!! mad

You act on my advice at your own risk!

Re: crontab repeats itself

Posted by: gordaen
Posted on: 2006-07-31 13:48:00

Mine doubles up (and even triples) fairly often too (21 entries when there should have been 13). I'll try Norm's suggestion and maybe that will tell us if it is a cron problem or not.

Check out Gordaen's Knowledge, the blog, and the MR2 page.

Re: crontab repeats itself

Posted by: wu1
Posted on: 2006-07-31 14:03:00

Thanks for your replies. Good to hear someone else experiencing this. :) I'll try /usr/bin/w now.

I am on plenty.dreamhost.com.

Re: crontab repeats itself

Posted by: gordaen
Posted on: 2006-07-31 17:01:00

Same thing happens to me with either command. I'm on rollo.

Check out Gordaen's Knowledge, the blog, and the MR2 page.

Re: crontab repeats itself

Posted by: wu1
Posted on: 2006-07-31 20:05:00

Same here. This is really bizarre. crontab doesn't run all commands multiple times, right?

Could a DH employee shed some light on this? I don't want to submit a ticket, as it's probably not warranted nor terribly urgent.

Re: crontab repeats itself

Posted by: gordaen
Posted on: 2006-07-31 23:08:00

I've had daily cron jobs run regularly for quite a while without ever having it trigger multiple times like this, but I've never run anything more common than daily, so I have no idea *shrug* You could submit it with low priority, I suppose.

Check out Gordaen's Knowledge, the blog, and the MR2 page.

Re: crontab repeats itself

Posted by: norm1037
Posted on: 2006-08-01 04:14:00

Just tried the same crontab as yourself and it seems to be okay:-

03:25:00 up 3 days, 13:26, 6 users, load average: 1.09, 2.03, 2.23
03:45:03 up 3 days, 13:46, 5 users, load average: 2.79, 2.46, 2.45
04:05:02 up 3 days, 14:06, 5 users, load average: 3.90, 3.86, 3.10

as does uptime without a path (using different time periods):-

03:26:02 up 3 days, 13:27, 6 users, load average: 1.58, 2.03, 2.22
03:46:03 up 3 days, 13:47, 5 users, load average: 1.69, 2.22, 2.36
04:06:02 up 3 days, 14:07, 5 users, load average: 3.58, 3.87, 3.15

I would not think it a server issue.
Do make sure that you have a blank line at the end of your crontab line to stop it looping. i.e. press enter once or twice before you save the crontab.



--
Norm


Opinions are my own views, not DreamHosts'.
I am NOT a DreamHost employee OK!! mad

You act on my advice at your own risk!

Re: crontab repeats itself

Posted by: shelves
Posted on: 2006-11-19 04:20:00


My cron job is repeating too. Sometimes at the same moment. Sometimes a minute later.

Did anyone find a solution to this?

Terry


Re: crontab repeats itself

Posted by: shelves
Posted on: 2006-11-19 04:32:00

Maybe this problem is related to the unstable system clock:

http://discussion.dreamhost.com/showflat.pl?Board=forum_programming&Number=60556

Terry


Tags: crontabuptimeusrrunning