RSS Forums RSS
Please support our Shell Scripting advertiser: Programming Forums

sendmail problem using cron

Join Date: Apr 2006
Location: Mexico DF
Posts: 3
Reputation: elidio is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
elidio's Avatar
elidio elidio is offline Offline
Newbie Poster

Help sendmail problem using cron

  #1  
Apr 26th, 2006
Hello, good afternoon.

Im a newby user writing my first shell script, and i trying to make it run with the cron utility.

If i run this code manually, the code was sucefull runned, but, when i put in this task in the crontab, the mail dont cant sended.

When i write a ps command, my task look like this:

root 2647 0.0 0.0 1584 640 ? S 18:35 0:00 CROND
root 2648 0.0 0.0 2128 932 ? S 18:35 0:00 /bin/bash -c /root/rmssProject/./rmmsConnection.sh
smmsp 2650 0.0 0.0 0 0 ? Z 18:35 0:00 /usr/sbin/sendmail -FCronDaemon -i -odi -oem root
root 3317 0.0 0.0 1796 500 ? S 18:38 0:00 sleep 2s


...and the mail cant sended. the process stay in stand by, and i dont now why, the cron cant process my script.

The uname command showme this:

Linux host.example.com 2.4.21-9.0.1.ELsmp #1 SMP Mon Feb 9 22:26:51 EST 2004 i686 i686 i386 GNU/Linux

And my code is this:

# Mail subject
SUBJECT="IP'S state"
# to mail's
EMAIL_LIST="ayudamicro@hotmail.com"

ssh script@xxx.xxx.xxx.xxx < outCommand.ptx | cat > listPop.pop
grep -i '^[a-z][0-9{3}\-][0-9{6}|a-f{6}]' listPop.pop > listCleanPop.pop
LINE=$(wc -l listCleanPop.pop | gawk '/[0-9]+ +*/ {print $1;}')
while test "$LINE" = "0";
do
ssh script@65.200.191.232 < outCommand.ptx | cat > listPop.pop
sleep 2s
grep -i '^[a-z][0-9{3}\-][0-9{6}|a-f{6}]' listaPop.pop > listcleanPop.pop
LINE=$(wc -l listaCleanPop.pop | gawk '/[0-9]+ +*/ {print $1;}')
done
sort listCleanPop.pop > listNewPop.pop
diff listNewPop.pop listBeforePop.pop > diferPop.pop
sed -e "s/^\([0-9]*\)a[0-9]*/The line \1 was added/" diferPop.pop |
sed -e "s/^\([0-9]*\)c[0-9]*/The line \1 was changed/" |
sed -e "s/^\([0-9]*\)d[0-9]*/The line \1 dont stay or was deleted/" |
sed -e "s/^\([0-9]*,[0-9]*\)a[0-9]*/The lines \1 was added/" |
sed -e "s/^\([0-9]*,[0-9]*\)c[0-9]*/The lines \1 was changed/" |
sed -e "s/^\([0-9]*,[0-9]*\)d[0-9]*/The lines \1 dont stay or was deleted/" | cat > mailBodyPop.pop
LINE=$(wc -l mailBodyPop.pop | gawk '/[0-9]+ +*/ {print $1;}')
if test "$LINE" = "0"; then
echo "No changes" | mail -s "$SUBJECT" "$EMAIL_LIST"
else
cp -f listNewPop.pop listBeforePop.pop
cat mailBodyPop.pop | /usr/sbin/sendmail -oi -s "$SUBJECT" "$EMAIL_LIST"
fi
exit 0


Can somebody explainme whats happend here?
Tanks and regards
--------------
Elidio I. Marquina Ordon~ez
Programing surfer
The game is never over
AddThis Social Bookmark Button
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:46 pm.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC