Created
October 27, 2015 11:40
-
-
Save artkirienko/7bfc51e49189d1a31213 to your computer and use it in GitHub Desktop.
сцанина
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ip=$1 | |
ADDR="`cat ./upd_hosts | grep $ip | awk -F ':' {'print $1'}`" | |
if ping -c 3 $ip >/dev/null | |
then | |
#version=$(expect get-suo-version1.exp $ip | tee -a $LOG | grep APP_VERSION | cut -d = -f 2 | tr -d "\r" | tr -d \') | |
text=`expect get-suo-version1.exp $ip` | |
version=$(echo $text | grep VERSION | cut -d = -f 2 | tr -d "\r" | cut -d \' -f 2) | |
ssherror=$(echo $text | grep "my remote host") | |
nofile=$(echo $text | grep "version.rb: No such file or directory") | |
if [ "$ssherror" != "" ]; then | |
echo "$ADDR%$ip%ssh error" | |
else | |
if [ "$nofile" != "" ]; then | |
echo "$ADDR%$ip%1.4.0" | |
else | |
verlen=$(echo ${#version}) | |
if [[ $verlen -lt 30 ]]; then | |
echo "$ADDR%$ip%$version" | |
else | |
echo "$ADDR%$ip%version error" | |
fi | |
fi | |
fi | |
# if [ "$version" != "1.5.2" ] | |
# then | |
# cap local deploy < $ip | |
# expect kill-unicorn.exp $ip | |
# cap local deploy:restart < $ip | |
# else | |
# echo " update not required" | |
# fi | |
else | |
echo "$ADDR%$ip%pingfalse" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment