码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-08-29 14:40:31      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:17.1   pow   err   自动   ssh   关机   block   power   .sh   

#!/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 root@192.168.17.190 date
ip=192.168.17.190
ssh root@192.168.17.190 /bin/gj.sh >/dev/null 2>&1
state=echo $?
decide $state $ip $date

date=ssh root@192.168.17.195 date
ip=192.168.17.195
ssh root@192.168.17.195 /bin/gj.sh >/dev/null 2>&1
state=echo $?

decide $state $ip $date

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

标签:17.1   pow   err   自动   ssh   关机   block   power   .sh   

原文地址:http://blog.51cto.com/jdonghong/2165894

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!