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
}
Hi all,
plz can anybody tell me that if a script written for Bash shell also work for other shells and if yes , how ???
Thanks and Regards
SONAL (2 Replies)
Hello everyone,
I have a script thats acting funky, what I would like to do is report to a file, how long its taking to get to certain area's, in seconds. For example.
-- Start timer
-- Run unix command 1
-- Run unix command 2
-- Stop timer
-- Report Seconds
-- etc etc
Is there a way... (3 Replies)
I am trying to set some environment variables in a shell script which is written in Kshell. I am invoking this script in .profile. The problem is envirnment variables are set within the script but after exiting the script those are gone. I don't have any problem with If I have Kshell as my default... (0 Replies)
Could someone tell me if there is any difference in using square brackets single or doubled pair?
So, do those two some how could be treted by shell differently:
if ; then <statements;> else <statements;> fi
and
if ] ; then <statements;> else <statements;> fi
Maybe any one could... (5 Replies)
Hi
I am getting some errors when i am running the shell script using the following syntax:
>abc.sh
but the same script works fine with the following syntax:
>sh abc.sh
wats the difference in both....please help
thanks in advance. (6 Replies)
I have a bash shell that even though it does not look pretty is working very well. Some of the steps are repetitive, something like this:
muscle -in ${e}.4 > $e.5
read -t1
sed ':a /^>/!N;s/\n\(\)/\1/;ta' $e.5 > $e.6
read -t2
awk '/>/{fr=$3;getline;n=split ($0,a,""); for (i=1;i<=n;i++)... (2 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Test that exactly one command line argrument is enter from the command line. If not, display the usage... (1 Reply)
Hello... and thanks in advance for reading this or offering me any assistance
I'm trying to understand specific differences between the various login scripts... I understand the differences between interactive vs non-interactive and login vs non-login shells... and that's not where my question... (4 Replies)