Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-10-2004, 02:10 PM   #1
LQ Newbie
Registered: Oct 2004
Posts: 8

Rep: Reputation: 0
Question Why Does One Cron Job Run Twice?

I have a file that tests email setup in /etc/cron/hourly and it runs every hour. It still runs every hour but now it runs twice on the hour one second apart. Now I get two emails every hour. Why has it started doing this? It still works and this is one of those little bothersome things that just eat at you because you can't figure out what is going on. Anybody got an idea why it's doing this?

Last edited by cpope67; 11-10-2004 at 02:13 PM.
Old 11-10-2004, 02:24 PM   #2
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 124Reputation: 124
No symlinks to itself, or calling of itself, right? And it didn't get added to an extra crontab, did it?
Old 11-15-2004, 10:40 AM   #3
LQ Newbie
Registered: Oct 2004
Posts: 8

Original Poster
Rep: Reputation: 0
No symlinks to itself, or call itself, I only have one crontab. This is all that it is doing:

echo "THIS IS A TEST EMAIL."|mail -s"POSTAL `date`"
echo " " >> /root/logs/test.log
echo "POSTAL `date`" >> /root/logs/test.log
echo "EMAIL IS UP. HAVE A NICE DAY ">> /root/logs/test.log
echo " " >> /root/logs/test.log
Old 11-16-2004, 05:44 AM   #4
Registered: Oct 2002
Location: Bangalore
Distribution: Gentoo Linux
Posts: 96

Rep: Reputation: 16

The first line in the script is sending a mail (to the address). So, you get one mail.

Then, cron has this feature of mailing you the output of a program executed using crontab. So, run the program on the command-line and see if it outputs anything. If it does, the same output should appear in a mail (second one) to you.

If it does not output anything, post the relevant crontab lines here, and also the whole script being called. Also, post the bodies of the two mails.

Old 11-16-2004, 06:09 AM   #5
Registered: Sep 2004
Location: Vestfold, Norway
Distribution: Slackware
Posts: 139

Rep: Reputation: 15
/etc/cron/hourly > /dev/null
This stops sending a mail containing the output of the job.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
cron job only runs halfway aunquarra Linux - General 15 01-31-2005 04:53 PM
cron job? dr_zayus69 Linux - Newbie 14 12-01-2004 06:16 PM
CRON Job tommytomato Fedora 12 09-13-2004 12:38 AM
cron job ? johnyy Linux - Software 3 12-10-2003 06:00 PM
Cron job T-Rex Linux - Newbie 1 09-26-2001 11:28 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:26 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration