Skip to content

Instantly share code, notes, and snippets.

@artkirienko
Created October 27, 2015 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artkirienko/7bfc51e49189d1a31213 to your computer and use it in GitHub Desktop.
Save artkirienko/7bfc51e49189d1a31213 to your computer and use it in GitHub Desktop.
сцанина
#!/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