Cronjob sending Email successfully with exec failed. errno=2 on log
836793Feb 4 2011 — edited Feb 6 2011Hi,
We are using a cron job to send emails about status. Due to security restrictions we are not running any SMTP client in the application server. In stead we are using a separate SMTP server and directly sending the mail content with from and to address to SMTP servers 25 port.
We are using the below code to achieve this.
exec 3<>/dev/tcp/$smtp/25
+ cat << EOF >&3+
HELLO `hostname`
MAIL From: <$from>
RCPT To: <$email>
RCPT To: <$email2>
DATA
Subject: $summary_subj
Reply-To: <$from>
+`mail_summary_body`+
+.+
QUIT
EOF
+ cat <&3+
It successfully executes to job and sends us emails.
However, in /var/cron/log it sends an error.
+> CMD: /mnt/xxxx/xxxxx/xxxx/xxxx.sh+
+> root 14286 c Fri Feb 4 06:33:00 2011+
+< root 14286 c Fri Feb 4 06:33:00 2011+
exec failed. errno=2.
Can you please let me know what is going on. Why am i seeing errors when the job is running just fine.