LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-04-2013, 01:52 PM   #1
prophoto
Member
 
Registered: Jul 2006
Posts: 30

Rep: Reputation: 0
Exclamation cron sending multiple emails


Hi Everyone I have a cron job setup to run a script which uploads daily backups to Amazon S3 via s3cmd. For some reason I receive about 75 emails while this script is running. Here is the script, any idea why it sends all of these emails?

#!/bin/bash

DIRECTORY="/var/www/backups/"

echo uploading to S3 with reduced redundancy...
/root/s3cmd/s3cmd put --recursive --rr $DIRECTORY/*.zip s3://backups/
echo Done uploading to s3, deleting files...
rm -rf $DIRECTORY/*.zip
echo Finished!
 
Old 10-04-2013, 04:17 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by prophoto View Post
Hi Everyone I have a cron job setup to run a script which uploads daily backups to Amazon S3 via s3cmd. For some reason I receive about 75 emails while this script is running. Here is the script, any idea why it sends all of these emails?
Code:
#!/bin/bash
DIRECTORY="/var/www/backups/"  

echo uploading to S3 with reduced redundancy...
/root/s3cmd/s3cmd put --recursive --rr $DIRECTORY/*.zip s3://backups/
echo Done uploading to s3, deleting files...
rm -rf $DIRECTORY/*.zip
echo Finished!
You don't tell us what the emails say, or how many files you're putting to S3, but according to the s3cmd instructions, it will echo something out for each file it pushes up. So...75 files, 75 echo statements. But, without seeing what any of the emails say, or knowing anything about your environment, we can't speculate much.
 
Old 10-07-2013, 11:18 AM   #3
prophoto
Member
 
Registered: Jul 2006
Posts: 30

Original Poster
Rep: Reputation: 0
Here's an email...the number of files varies.


uploading to S3 with reduced redundancy...
Done uploading to s3, deleting files...
Finished!

Apparently it is sending an email for each loop, any idea how to stop that?
 
Old 10-07-2013, 02:52 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by prophoto View Post
Here's an email...the number of files varies.


uploading to S3 with reduced redundancy...
Done uploading to s3, deleting files...
Finished!

Apparently it is sending an email for each loop, any idea how to stop that?
Loop?? The bash script you posted doesn't have a loop in it. Did you post the ENTIRE script, or just part of it? Or is that script called from another script somewhere?
 
Old 10-07-2013, 03:07 PM   #5
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
cron will send an email when its jobs 'see' stderr or stdout
remove the echos, and you will get no emails

However, I do not see why you are getting ~75 emails, that script should only send one
How often does that cron run?
Show us your crontab entry

When you post 'code' use

[code]
Your Code Here.
[/code]
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mail program sending multiple emails countrydj Linux - General 2 09-02-2011 11:24 AM
sendmail is sending unnecessary multiple copies of emails from php form swg1cor14 Linux - Server 1 01-07-2010 08:25 AM
after upgrade to ubuntu 8.04 from 7.10 my cron is not sending emails eteck Linux - Server 1 08-26-2009 07:35 AM
Prevent Cron from sending emails carmeng Linux - Software 3 11-10-2003 05:08 AM
Cron has stopped sending emails shanagg Linux - General 0 07-02-2003 01:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:08 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
Open Source Consulting | Domain Registration