Pregunta

I have a unique issue, i am in a unix environment and have a ksh script that ssh's to multiple sites, executes some code and then returns a response and then emails that response to an email address.

The script works perfectly when i run it, but since it must run for several hours i wish to nohup the script.

Here is where the problem is. When i nohup the script the email is not sent. I have scoured the boards looking for a reason or solution to no avail. if someone could point me in the right direction i would greatly appreciate it.

Here is my mail portion of the script:

mail -s "subject"  email@address.com  < /usr/etc/bin/mydir/infofile.out &&
rm -f infofile.out
exit;

EDIT: my environment is AIX 6.1.7.1

¿Fue útil?

Solución

Finally figured out the answer, and even thou i was being dumb, i feel i have a responsibility to answer anyway, just in case someone else runs across this issue.

Turns out when i nohup my script it DOES send the email correctly. Its just that by nohuping and logging out it forces the email to be sent from the unix mail utility's default email address, and in my environment that address sends out hundreds of useless alerts, most of which i have filtered in outlook to go to a trash folder, well the email i was sending ended up in that trash folder.

Thanks to those who responded, especially shellter, your recommendation to use shell debugging is what let me know that it was sending from that default mail account.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top