Operating System - Linux
1830207 Members
1799 Online
109999 Solutions
New Discussion

Re: sendmail not working from script

 
SOLVED
Go to solution
skt_skt
Honored Contributor

sendmail not working from script

I have a small script like this
========
#This script is used for checking the console connectivity to the following servers.


exgld180c=155.248.115.106
exgld178c=155.248.115.177
exgld179c=155.248.115.178

for i in $exgld180c $exgld178c $exgld179c
do
if ping ${i} -c 2 -w 15 >/dev/null
then
echo "Console IP still available for ${i} at `date`">>/opt/local/unix/logs/exgld_console_ipcheck.log
else
echo "Console IP NOT available now for ${i} at `date`">>/opt/local/unix/logs/exgld_console_ipcheck.log
echo "Console IP NOT available now for ${i}" |sendmail t.kumar@alcoa.com gidunixsupport@alcoa.com
fi
done
=====

I get the sendmail notification if i run that script manually. But i am not receiving alert while scheduled through cron.

So far restarted the sendmail ; also added #!/bin/bash and #!/bin/ksh at the begining of the script and no change. Any suggetions
1 REPLY 1
Ivan Ferreira
Honored Contributor
Solution

Re: sendmail not working from script

Even if your script hash the shell defined, the PATH environment variables are not. Use the absolute path for all commands in your script, specially /usr/sbin/sendmail.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?