I have a cluster with multiple linux servers (6) and IBM Websphere Application Server is running on that. These IBM Websphere Application Servers needs to be started up in a specific order, first server1, then server2 etc.
Currently I have a script that will stop and start the IBM Websphere Application Server when I stop or start the linux server itself.
Now I want to build in that script that it will check what day it is, and biased on the hostname it waits until a specific time, for example:
- server1, needs to check that if it is a Sunday, and hostname is server1 it needs to wait until 2:00 AM then it will execute
- server2, needs to check that if it is a Sunday, and hostname is server2 it needs to wait until 2:30 AM then it will execute
- server3, needs to check that if it is a Sunday, and hostname is server3 it needs to wait until 3:00 AM then it will execute
My issue is how do I code that wait until a specific time? If have the following to check about the day and hostname:
DOW=$(date +"%a")
if [ $DOW = "Sun" ] then
if [ $HOSTNAME = server1 ] then
wait until 2:00 AM
and then continue with this
cat $WAS_TEMP/nodeagent.startup | while read NODE
do
echo "Start Nodeagent"
/opt/ws/profiles/$NODE/bin/startNode.sh > /dev/null &
sleep 45
done
if [ $HOSTNAME = server2 ] then
wait until 2:30 AM
and then continue with this
cat $WAS_TEMP/nodeagent.startup | while read NODE
do
echo "Start Nodeagent"
/opt/ws/profiles/$NODE/bin/startNode.sh > /dev/null &
sleep 45
done
if [ $HOSTNAME = server3 ] then
wait until 3:00 AM
and then continue with this
cat $WAS_TEMP/nodeagent.startup | while read NODE
do
echo "Start Nodeagent"
/opt/ws/profiles/$NODE/bin/startNode.sh > /dev/null &
sleep 45
done
fi
It has to be done in the script itself so no crontab.