本文共 1071 字,大约阅读时间需要 3 分钟。
#!/bin/sh
#author:jerry#create date 2015-12#last update: 2018-8-27decide() { [ $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>&1state=echo $?
decide $state $ip $date
date=ssh cwgzxt -p1211 /bin/date
ssh cwgzxt -p1211 hostname -i
ssh cwgzxt -p1211 /sbin/poweroff >/dev/null 2>&1state=echo $?
decide $state $ip $date date=gom /bin/date
gom hostname -i
gom /sbin/poweroff >/dev/null 2>&1state=echo $?
decide $state $ip $date date=gos /bin/date
gos hostname -i
gos /sbin/poweroff >/dev/null 2>&1state=echo $?
decide $state $ip $date date=ssh root@192.168.17.190 date
echo $?
decide $state $ip $date date=ssh root@192.168.17.195 date
echo $?
decide $state $ip $date
转载于:https://blog.51cto.com/jdonghong/2165894