We shutdown the application when we backup the DB, i made a script that checks the db server from the APPL server and starts the application.
This script works when i execute manual but when it executes from the crontab the IF statements always comes as true.
Code: Select all
#!/bin/bash
var="no"
echo "$(date)" | mail -s "Oracle is down for backup." linuxadmin@cjh.org
while [[ "$var" != "yes" ]]
do
#echo "$(date)" | mail -s "Oracle is down for backup." linuxadmin@cjh.org
if ssh root@dbserver -p 22 ps aux | grep -v 'grep' | grep -q 'pmon';then
{
echo 'Found'
var="yes"
sleep 1m
echo "$(date)" | mail -s "Oracle has started and now starting Rosetta." linuxadmin@cjh.org
/exlibris/dps/d4_1/profile/dps_startup_all
}
else
{
echo 'Not Found'
}
fi
date
sleep 5m
done