[root@centos8 /date/shell2 ]$ whatis sshpass
sshpass (1) - noninteractive ssh password provider
-e Password is passed as env-var "SSHPASS"[root@centos8 /date/practice ]$ whatis ssh-keygen
ssh-keygen (1) - authentication key generation, management and conversion
[-f output_keyfile][-P old_passphrase][root@centos8 /date/practice ]$ whatis ssh-copy-id
ssh-copy-id (1) - use locally available keys to authorise logins on a remote machine
ssh-copy-id [-f][-n][-i [identity_file]][-p port][-o ssh_option][user@]hostname
ssh
-o option
Can be used to give options in the format used in the configuration file. This is useful for specifying options forwhich there is no separate command-line flag. For full details of the options listed below, and their possible values,see ssh_config(5).
StrictHostKeyChecking
If this flag is set to “no” or “off”, ssh will automati‐cally add new host keys to the user known hosts files and allow connections to hosts with changed hostkeys to proceed,subject to some restrictions
4、30s检测本机的80端口是否开启,未开启的话重启httpd服务,并邮件通知自己
#!/bin/bash
#fielname=chech_80_httpd.sh
netstat -ntl |grep -w 80
if [ $? -eq 1 ];then
systemctl restart httpd && mail -s "`date +%F-%T` httpd restart" ******@qq.com
echo "`date +%F-%T` httpd server abnormal restart" >> /tmp/httpstatus.log
else
echo "`date +%F-%T` httpd server normal" >> /tmp/httpstatus.log
fi
* * * * * bash /date/shell1/chech_80_httpd.sh;/date/shell1/chech_80_httpd_30s.sh
[root@centos8 /date/shell1 ]$ cat /tmp/httpstatus.log
2021-03-28-19:56:01 httpd server normal
2021-03-28-19:56:32 httpd server abnormal restart
2021-03-28-19:57:01 httpd server normal