Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- MQ_URLFILE="/var/run/ais.url"
- MQ_URL1="mq-1.server.ru:777"
- MQ_URL2="mq-2.server.ru:777"
- if [ -f $MQ_URLFILE ]; then
- MQ_URL=`cat ${MQ_URLFILE}`
- echo "Read: $MQ_URL"
- else
- conn=`curl -m 1 -S $MQ_URL1 2>&1 | tail -1 | awk '{print $2}'`
- if [ $conn != '(7)' ] && [ $conn != '(6)' ] ; then
- echo "Alive: $MQ_URL1"
- echo $MQ_URL1 > $MQ_URLFILE
- MQ_URL=$MQ_URL1
- else
- conn=`curl -m 1 -S $MQ_URL2 2>&1 | tail -1 | awk '{print $2}'`
- if [ $conn != '(7)' ] && [ $conn != '(6)' ] ; then
- echo "Alive: $MQ_URL2"
- echo $MQ_URL2 > $MQ_URLFILE
- MQ_URL=$MQ_URL2
- else
- echo 'No MQ available'
- exit
- fi
- fi
- fi
Add Comment
Please, Sign In to add comment