我需要为远程备份制作 bash 文件。如果远程机器出现故障,我想通过电子邮件发送提醒。所以这个脚本需要测试远程机器是否开启了 ssh,如果有,则进行备份,否则发送邮件。
sshpass -p pass ssh -l root $host
this give me connection timed out if remote machine is down and ok wheen it is online
1condition, do it when machine is on
.....rsync backup....
2condition, do it wheen machine is down
...sending mail....