#!/bin/sh
#author:jerry
#create date 2015-12
#last update: 2018-8-27
decide() {
[ $1 == 0 ] && echo "$2 $3 shutdown success" >>down.log || echo "$2 $3 shutdown fail" >>down.log
}
alias gom='ssh -p 1211 cwdb_m'
alias gos='ssh -p 1211 cwdb_s'
date=ssh js /bin/date
ip=ssh js hostname -i

down.log
ssh js /sbin/poweroff >/dev/null 2>&1
state=echo $?
decide $state $ip $date

date=ssh cwgzxt -p1211 /bin/date
ip=ssh cwgzxt -p1211 hostname -i
ssh cwgzxt -p1211 /sbin/poweroff >/dev/null 2>&1
state=echo $?
decide $state $ip $date

date=gom /bin/date
ip=gom hostname -i
gom /sbin/poweroff >/dev/null 2>&1
state=echo $?
decide $state $ip $date

date=gos /bin/date
ip=gos hostname -i
gos /sbin/poweroff >/dev/null 2>&1
state=echo $?
decide $state $ip $date

date=ssh [email protected] date
ip=192.168.17.190
ssh [email protected] /bin/gj.sh >/dev/null 2>&1
state=echo $?
decide $state $ip $date

date=ssh [email protected] date
ip=192.168.17.195
ssh [email protected] /bin/gj.sh >/dev/null 2>&1
state=echo $?

decide $state $ip $date