I have no idea what is happening here ?? I have a script which give the status of db down or up .if i run in normal terminal like command prompt its wrking but in crons only print and send mailx msg.please help me i am struggling since long.Somebody advice me to put shebag i put #!/bin/sh but nothing working.
if i schedule in crons liks
* * * * * /home/bin/defesty.sh
it's only print msg like db down but If execute normal it's showing correct result. Please help me where i am lacking.
#!/bin/sh
cd /sar/chl/db/ladb1
$DLC/bin/proutil ladb1 -C holder > /dev/null
retcode=$? > /home/bin/t.txt
if [[ $retcode -ne 16 ]] ;
then
echo "Chile ladb1 database is down in production hours" > /home/bin/logs/dboutage1.txt
mailx -s "Chile db ladb1 down" shaatre@hit.com < /home/bin/logs/dboutage1.txt
fi
cd /sar/chl/db/ladb2
$DLC/bin/proutil ladb2 -C holder > /dev/null
retcode=$?
if [[ $retcode -ne 16 ]] ;
then
echo "Chile ladb2 database is down in production hours" > /home/bin/logs/dboutage2.txt
mailx -s "Chile db ladb2 down" shaiae@hit.com < /home/bin/logs/dboutage2.txt
fi
cd /sar/pru/db/ladb1
$DLC/bin/proutil ladb1 -C holder > /dev/null
retcode=$?
if [[ $retcode -ne 16 ]] ;
then
echo "Peru ladb1 database is down in production hours" > /home/bin/logs/dboutage3.txt
mailx -s "Peru db labdb1 down" shaiae@hit.com < /home/bin/logs/dboutage3.txt
fi
fi
cd /sar/pru/db/ladb2
$DLC/bin/proutil ladb2 -C holder > /dev/null
retcode=$?
if [[ $retcode -ne 16 ]] ;
then
echo "Peru ladb2 database is down in production hours" > /home/bin/logs/dboutage4.txt
mailx -s "Peru db ladb2 down" shaiai@hit.com < /home/bin/logs/dboutage4.txt
fi
Please help me I am strugling