Hi All,
I need some urgent help regarding some info.
I have a cluster of servers for which I have two scripts for management.
control.sh is a bash script meant for restarting/stopping the servers.
manger.ksh is a kshell script. It is a master script to manage restarting/stoppping and deploying activities also on these servers.
Issue: I have to set the value of a variable just before restarting the servers. So when I use manager.ksh after setting the variable it wasnt setting the value of the variable, but when i used control.sh the necessary changes were looking
good.
Can anyone help me in this regard. Propmpt reply would be appreciated!
Thanks
This question is like:
I do THIS and get THIS result. But, when I do THAT, I get THAT result. Why?
Seriously, do you think anyone can answer you without knowing what THIS and THAT are?
Please post the 2 scripts or their relevant portions. Also mention the way you invoke these scripts and the exact issue.
i am sorry i am bit naive into this forum..
this is inside manger.ksh
function startProcess
{
for INSTANCE in ${CONTENT}
do
PROC_COUNT=`ssh ${SERVER} "ps -ef | egrep -e '-c ${INSTANCE}'| grep -v grep | wc -l"`
if [[ ${PROC_COUNT} -gt 0 ]]; then
echo "${SERVER}: ${INSTANCE} process is ACTIVE. "
else
ssh ${SERVER} "${CONSCRIPTS}/atg_control.sh -e ${ENV} -i ${INSTANCE} -c start" > /dev/null &
if [[ ${?} -eq 0 ]]; then
echo "${SERVER}: Startup initiated for ${INSTANCE}. Run checkstatus to check progress."
else
echo "ERROR: Problems Encountered with startup of ${INSTANCE} on ${SERVER}"
exit 1
fi
if [[ ${WAIT} -gt 0 ]]; then
echo "Server startup in progress..."
while [[ ${PROC_COUNT} -gt 0 ]]
do
sleep 10
PROC_COUNT=`ssh ${SERVER} "ps -ef | egrep -e '-c ${INSTANCE}'| grep -v grep | wc -l"`
done
fi
fi
done
}
function stopProcess
{
for INSTANCE in ${CONTENT}
do
PROC_COUNT=`ssh ${SERVER} "ps -ef | egrep -e '-c ${INSTANCE}'| grep -v grep | wc -l"`
if [[ ${PROC_COUNT} -gt 0 ]]; then
ssh ${SERVER} "${CONSCRIPTS}/atg_control.sh -e ${ENV} -i ${INSTANCE} -c stop" > /dev/null &
if [[ ${?} -eq 0 ]]; then
echo "${SERVER}: Shutdown initiated for ${INSTANCE}. Run checkstatus to check progress."
else
echo "ERROR: Problems Encountered with shutdown of ${INSTANCE} on ${SERVER}"
exit 1
fi
if [[ ${WAIT} -gt 0 ]]; then
echo "Server shutdown in progress..."
while [[ ${PROC_COUNT} -gt 0 ]]
do
sleep 10
PROC_COUNT=`ssh ${SERVER} "ps -ef | egrep -e '-c ${INSTANCE}'| grep -v grep | wc -l"`
done
echo "Server shutdown complete"
fi
else
echo "${SERVER}: ${INSTANCE} is already down"
fi
done
}
function restartProcess
{
for INSTANCE in ${CONTENT}
do
echo "${SERVER}: Restart initiated for ${INSTANCE}"
ssh ${SERVER} "${CONSCRIPTS}/atg_control.sh -e ${ENV} -i ${INSTANCE} -c restart" > /dev/null &
if [[ ${?} -eq 0 ]]; then
echo "${SERVER}: Restart initiated for ${INSTANCE}. Run checkstatus to check progress."
else
echo "ERROR: Problems Encountered with restart of ${INSTANCE} on ${SERVER}"
fi
done
}
function main
{
for SERVER in ${SERVLIST}
do
case ${ACTION} in
stop) stopProcess ${SERVER} ${CONTENT} ${ENV};;
start) startProcess ${SERVER} ${CONTENT} ${ENV};;
restart) restartProcess ${SERVER} ${CONTENT} ${ENV};;
install) installJboss ;;
deploy) deployjboss ;;
*) usage;;
esac
done
}
=========================================================
and i have attached control.sh:
i invoke them by ./control.sh and passing the relevant options....and similarly for manager script also.