当前位置 : 主页 > 网络安全 > 测试自动化 >

那些年不上运维自动化 NO ZUO NO DIE 写下的关机脚本

来源:互联网 收集:自由互联 发布时间:2021-06-19
#!/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‘
#!/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

网友评论