Re: Malfunction in bash script

From: Michael Tosch (eedmit_at_NO.eed.SPAM.ericsson.PLS.se)
Date: 01/29/04


Date: 29 Jan 2004 15:49:34 GMT

In article <bvb6tm$6pf$3@atlantis.news.tpi.pl>, Adrian <adrianne54@poczta.onet.pl> writes:
> Hello!
> I've written script which should tar all files specified in command
> line, then split it, uuencode every part (all that WORKS) and than
> should part by part send all of them in separate e-mails waiting
> specified time before sending each e-mail.
> Program seems to work, it echos text for each file which he should send
> (I've added it for debug purposes) but I don't receive all of the parts
> (normally only half of them). I've set delay to 240 - still doesn't work
> as it should. My mail-program checks account every 2 minutes.
> Below I include section responsible for sending e-mails. $autoryzacja is
> set by default to "", it could include auth plain or auth login text.
> If someone please could write what's wrong I would be extremally
> grateful. It's my first so long script and now I cannot even concentrate
> on it.
>
> Adrian
>
>
> counter=1
> ls_parts=`ls $project_dir"/parts_encoded"`
> for split_part in $ls_parts
> do
> touch $temp_mail
> echo -e -n "EHLO $server\n$autoryzacja\nmail from: <$sender>\nrcpt to:
> <$receiver>\nDATA\nFrom: <$sender>\nTo:
> <$receiver>\nReply-to:<$sender>\nX-mailer: split_sender\nXsend-content:
> encoded_part\nXsend-project_name: $project_name\nSubject: $project_name
> part $split_part by split_sender\n" > $temp_mail
> cat $project_dir"/parts_encoded/"$split_part >> $temp_mail
> echo -e -n "\n.\nQUIT\n" >> $temp_mail
> echo "Sending part $counter ( "$project_name" ["$split_part"] )"
> cat $temp_mail | nc $server 25 > /dev/zero

What is >/dev/zero? Didnt you mean >/dev/null?

> rm -f $temp_mail
> counter=$(($counter+1))
> echo "Sleep for $delay seconds"
> sleep $delay
> done

You generally dont need a delay. It is polite to give the
mail server 1 second to take breath.

Rather assembling all the SMTP commands like EHLO,DATA,QUIT
you could simply pipe it to mail or /usr/lib/sendmail.
These programs also generate a log message for every mail sent.

All this has probably no influence on mail loss.
Check your mail system. Do you have M$-Exchange somewhere?
The SMTP gateways are famous for "swallowing" mails.

-- 
Michael Tosch
IT Specialist
HP Managed Services Germany
Phone +49 2407 575 313


Relevant Pages

  • Re: Malfunction in bash script
    ... > I've written script which should tar all files specified in command ... > line, then split it, uuencode every part and than ... > Below I include section responsible for sending e-mails. ... keeping it to see what the remote mail server said would be a better bet. ...
    (comp.unix.shell)
  • Malfunction in bash script
    ... I've written script which should tar all files specified in command ... I've set delay to 240 - still doesn't work ... Below I include section responsible for sending e-mails. ... it could include auth plain or auth login text. ...
    (comp.unix.shell)
  • Re: Fedora May Be Killing Your Laptops Hard Drive?
    ... the command over the last few minutes: ... During this time, I've read a few e-mails, looked at a few webpages, ... anyone has some things to mitigate the problem, ...
    (Fedora)
  • Re: [SLE] KMail
    ... > here a problem that's driving me crazy. ... > I do not succed in moving my e-mails from KMail of SuSE 8.1 to the one of ... and tell us what command you are ...
    (SuSE)
  • Re: Changing From: address of periodic scripts
    ... Jonathan Belson wrote: ... After playing with MASQUERADE_AS, MASQUERADE_DOMAIN| plus a few FEATURES, I've managed to change the 'From:' address for | e-mails sent via the command line. ... Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org ...
    (freebsd-questions)