We have developed the script which will send an (html)attachment in through mail. The stand alone script is working fine ,but when we schedule it cron the "nail" command is not working that is we are not receving any mail.
Following is the command which we used to send the mail.
/usr/bin/nail -s "Reports generation mail" -a Units.html -a Hundreds.html abc@xyz.com < /dev/null
In the cron the script is schedule everyday. Following is the cron entry:
Why the "nail" command is not working in cron...
I also tried to use "mailx" command but its also not working..
Can anybody help me regarding the same??
If the script is working when you, you execute it, that means you have something more in your environment cron is missing...
Have you tried to schedule under your own account? I would give a try and add as first line to the script
. $HOME/.profile
and see if it works now ($HOME may need to be substituted to the proper value...)
Otherwise, a very easy test is to try it with "at". If that works, it's absolutely an environment variable not set in cron. See Cron, Batch and At for suggestions on fixing that.
As a minimum this script will need a "cd" to wherever the files "Units.html" and "Hundreds.html" reside.
When you say "not working" please post any error messages. In this case the error messages will be in the unix mail for the account who owns the cron.
Personally I would take all processing out of cron totally (including >> redirection) and do the whole lot in the shell script under a controlled environment with a shebang line at the start of the script. Obviously still invoking the shell script from cron.