telemorgan
MIS
Hey everyone
Could you guys help me to understand what is going on here. I have this simple script(script A). When I run it from the command prompt of the "oracle" user account,it is successful (output A). But when I setup the job to run under the same oracle user's cron it fails (output B). Please help me to explain what is going here and how I can fix it.
SCRIPT A:
#!/bin/ksh -x
#
# SET GLOBAL VARIABLES
DB="deltekcp griffon epay deltektc"
#
for x in $DB; do
if [ `/u01/app/oracle/product/8.1.7/bin/tnsping $x | grep -c "^OK "` -ne 0 ]; then
echo "$x : up"
else
echo "$x : down"
fi
done
OUTPUT A:
+ DB=deltekcp griffon epay deltektc testcp
+ grep -c ^OK
+ /u01/app/oracle/product/8.1.7/bin/tnsping deltekcp
+ [ 1 -ne 0 ]
+ echo deltekcp : up
deltekcp : up
+ grep -c ^OK
+ /u01/app/oracle/product/8.1.7/bin/tnsping griffon
+ [ 1 -ne 0 ]
+ echo griffon : up
griffon : up
+ /u01/app/oracle/product/8.1.7/bin/tnsping epay
+ grep -c ^OK
+ [ 1 -ne 0 ]
+ echo epay : up
epay : up
+ /u01/app/oracle/product/8.1.7/bin/tnsping deltektc
+ grep -c ^OK
+ [ 1 -ne 0 ]
+ echo deltektc : up
deltektc : up
OUTPUT B:
+ DB=deltekcp griffon epay deltektc testcp
+ grep -c ^OK
+ /u01/app/oracle/product/8.1.7/bin/tnsping deltekcp
+ [ 0 -ne 0 ]
+ echo deltekcp : down
deltekcp : down
+ grep -c ^OK
+ /u01/app/oracle/product/8.1.7/bin/tnsping griffon
+ [ 0 -ne 0 ]
+ echo griffon : down
griffon : down
+ grep -c ^OK
+ /u01/app/oracle/product/8.1.7/bin/tnsping epay
+ [ 0 -ne 0 ]
+ echo epay : down
epay : down
+ grep -c ^OK
+ /u01/app/oracle/product/8.1.7/bin/tnsping deltektc
+ [ 0 -ne 0 ]
+ echo deltektc : down
deltektc : down
Thanks
Could you guys help me to understand what is going on here. I have this simple script(script A). When I run it from the command prompt of the "oracle" user account,it is successful (output A). But when I setup the job to run under the same oracle user's cron it fails (output B). Please help me to explain what is going here and how I can fix it.
SCRIPT A:
#!/bin/ksh -x
#
# SET GLOBAL VARIABLES
DB="deltekcp griffon epay deltektc"
#
for x in $DB; do
if [ `/u01/app/oracle/product/8.1.7/bin/tnsping $x | grep -c "^OK "` -ne 0 ]; then
echo "$x : up"
else
echo "$x : down"
fi
done
OUTPUT A:
+ DB=deltekcp griffon epay deltektc testcp
+ grep -c ^OK
+ /u01/app/oracle/product/8.1.7/bin/tnsping deltekcp
+ [ 1 -ne 0 ]
+ echo deltekcp : up
deltekcp : up
+ grep -c ^OK
+ /u01/app/oracle/product/8.1.7/bin/tnsping griffon
+ [ 1 -ne 0 ]
+ echo griffon : up
griffon : up
+ /u01/app/oracle/product/8.1.7/bin/tnsping epay
+ grep -c ^OK
+ [ 1 -ne 0 ]
+ echo epay : up
epay : up
+ /u01/app/oracle/product/8.1.7/bin/tnsping deltektc
+ grep -c ^OK
+ [ 1 -ne 0 ]
+ echo deltektc : up
deltektc : up
OUTPUT B:
+ DB=deltekcp griffon epay deltektc testcp
+ grep -c ^OK
+ /u01/app/oracle/product/8.1.7/bin/tnsping deltekcp
+ [ 0 -ne 0 ]
+ echo deltekcp : down
deltekcp : down
+ grep -c ^OK
+ /u01/app/oracle/product/8.1.7/bin/tnsping griffon
+ [ 0 -ne 0 ]
+ echo griffon : down
griffon : down
+ grep -c ^OK
+ /u01/app/oracle/product/8.1.7/bin/tnsping epay
+ [ 0 -ne 0 ]
+ echo epay : down
epay : down
+ grep -c ^OK
+ /u01/app/oracle/product/8.1.7/bin/tnsping deltektc
+ [ 0 -ne 0 ]
+ echo deltektc : down
deltektc : down
Thanks