I have a need due time constraint to issue the mail command in background. I have a script that sends a message to a mail address as follows :-
echo "$MLINE" | mail -s "$HOST - $TEXT" name@co.com &
The script runs frequently and I check to see if the script is active and if it is , it will wait until there is no script running to execute completely. The problem is that due to the time it takes for the above statement to complete, I end up with a lot of waiting scripts and as such end up never executing completely.
I have pushing the command in the background, but this did not help. I have searched and found references to the batch command, but cannot get this working. We are on AIx 52.
Maybe from that you can tell if its taking a long time to send the data (is it alot of data?) or having trouble eastablishing connection with the smtp server or maybe even the dns lookup.
When I check the mailq, or try and send a mail out, It appears to hang and finally responds with the following :-
root@mybox#/exedir>echo "testing" | /usr/sbin/sendmail -v user@mycompany.com
WARNING: local host name (mybox) is not qualified; fix $j in config file