LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-31-2011, 10:31 AM   #1
linuxguy7820
Member
 
Registered: Mar 2011
Distribution: CentOS, RHEL, Fedora
Posts: 35

Rep: Reputation: 0
Cronjob or sendmail sends mutiple emails


Hello:

I'm experiencing an unusual problem. I have a cronjob that runs weekly at 2am, the script uses nmap to scan servers to look for open ports. Once the script is finished running it sends out a nicely formatted email with the results. Here's the thing that's driving me crazy the script or sendmail sends out multiple copies of the same message one after the other a minute apart for each (it does this about 20 times). So first thought was the sendmail part was caught in a loop, but it's not, second thought was to run the script manually and it works as expected. So the last thing I tried was to reschedule the cronjob at a different time, in this case I rescheduled the cronjob to kickoff in 10 minutes so I could actually watch it (in this case 6:30P) - I did log off the server before the job ran. The result was the script ran as expected.

Any ideas or pointers would be great!
 
Old 03-31-2011, 10:36 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Hi and welcome to LinuxQuestions! What is the original crontab entry? Are you sure the cron job did not run multiple times for some reason (please, check the /var/log/cron file to be sure)?
 
1 members found this post helpful.
Old 03-31-2011, 11:08 AM   #3
linuxguy7820
Member
 
Registered: Mar 2011
Distribution: CentOS, RHEL, Fedora
Posts: 35

Original Poster
Rep: Reputation: 0
Nice call, it is actually running it mutiple times... And I think I know why... The crontab is this:
# Running portscan check
* 4 * * 0 /home/scripts/portscan.sh > /dev/null 2>&1

(I thought it would just run @ 4AM)

I'm basically saying run this script every minute Sunday @ 4AM -- correct???
 
Old 03-31-2011, 11:33 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Quote:
Originally Posted by linuxguy7820 View Post
I'm basically saying run this script every minute Sunday @ 4AM -- correct???
Correct!
 
Old 03-31-2011, 11:35 AM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,208

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
Quote:
Originally Posted by linuxguy7820 View Post
Nice call, it is actually running it mutiple times... And I think I know why... The crontab is this:
# Running portscan check
* 4 * * 0 /home/scripts/portscan.sh > /dev/null 2>&1

(I thought it would just run @ 4AM)

I'm basically saying run this script every minute Sunday @ 4AM -- correct???
To run it at 4 am on sunday

Code:
0 4 * * 0 /home/scripts/portscan.sh > /dev/null 2>&1
 
1 members found this post helpful.
  


Reply


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
[SOLVED] SendMail -> Same Server, Multiple Domains with mutiple same users. kingkashif Linux - Server 5 12-28-2009 01:48 PM
Moving emails in evolution sends them to trash. Red_Shadow Linux - Desktop 2 09-14-2009 04:04 AM
SENDMAIL sends to all domains but one ALInux Linux - Server 2 07-25-2007 02:42 AM
Why sendmail sends message in two pieces ? mikeshn Linux - Software 0 08-19-2003 06:49 PM
Sendmail sends but doesn't receive r-l-j Linux - General 0 11-13-2002 12:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:51 AM.

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