Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #set -x
- servers=/Users/spala/works/iplist.txt
- #set -u
- while read -u140 multiplessh;
- do
- USER="testuser"
- PASS="testpassword"
- PORT="55022"
- current_ver="3.2.3"
- command1="/usr/sbin/zabbix_agentd -V & hostname -f /dev/null"
- connection_method=`/usr/local/bin/sshpass -p $PASS /usr/bin/ssh -n -p$port -o StrictHostKeyChecking=no $user@$multiplessh $command1`
- first_step="$connection_method"
- ###
- result=$(echo $first_step |grep 'zabbix_agentd|.spala' | awk '{print $1, $5}')
- # - 'zabbix_agentd' ---> "zabbix_agent -V" command output..
- # - '.spala' my server hostname fqdn..--> test.spala test1.spala test2.spala
- hostname=$(echo $result |awk '{print $1}')
- version=$(echo $result |awk '{print $2}')
- if [[ "$version" == "$current_ver" ]]
- then
- echo "$hostname used version ---> $version"
- echo "Version is ok..."
- exit 1
- else
- echo "$hostname used version ---> $version"
- echo "Old version.. Need update !"
- exit 1
- fi
- exit 0
- done 140<"$servers"
- sh test.sh
- test1.spala used version ---> 3.2.2
- Old version.. Need update !
- cat /Users/spala/works/iplist.txt
- 1.1.1.1
- 2.2.2.2
- 3.3.3.3
- 4.4.4.4
- 5.5.5.5
- ...
- total 140 servers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement