1、判断当前磁盘剩余空间是否有20G,如果小于20G,则将报警邮件发送给管理员,每天检查次磁盘剩余空间。
2、判断web服务是否运行 (1、查看进程的方式判断该程序是否运行,2、通过查看端口的方式判断该程序是否运行),如果没有运行,则启动该服务并配置防火墙规则。
3、使用curl命令访问第二题的web服务,看能否正常访问,如果能正常访问,则返回web serveris running;如果不能正常访问,返回12状态码。
1、
[root@node2 ~]# yum install s-nail -y 安装邮件服务
[root@node2 ~]# vim /etc/s-nail.rc 编写邮件配置
set from=1054536374@qq.com
set smtp=smtp.qq.com
set smtp-auth-user=1054536374@qq.com
set smtp-auth-password=zyodyndguvgdbfaf 授权码
set smto-auth=login
[root@node2 ~]# vim df_test.sh
[root@node2 ~]# vim /etc/crontab 编写周期性任务
0 0 * * * root /bin/bash /root/df_test.sh
2、[root@node2 ~]# vim httptest.sh
[root@node2 ~]# bash httptest.sh
3、[root@node1 ~]# vim httpget.sh
[root@node1 ~]# bash httpget.sh