1、判断当前磁盘剩余空间是否有20G,如果小于20G,则将报警邮件发送给管理员,每天检查一次磁盘剩余空间。
2、判断web服务是否运行
1)、查看进程的方式判断该程序是否运行
2)、通过查看端口的方式判断该程序是否运行),如果没有运行,则启动该服务。
3、使用curl命令访问第二题的web服务,看能否正常访问,如果能正常访问,则返回web server is running;如果不能正常访问,返回12状态码。
1、判断当前磁盘剩余空间是否有20G,如果小于20G,则将报警邮件发送给管理员,每天检查一次磁盘剩余空间。
(1)、服务端和客户端安装mailx和postfix
#服务端
[root@server ~]# yum install postfix -y
[root@server ~]# systemctl enable postfix --now
#客户端
[root@client ~]# yum install sendmail -y
(2)、编写脚本
[root@server ~]# cat mail.sh
#!/bin/bash
##############################################################
# File Name: mail.sh
# Author:friday
# Email: friday@163.com
# Organization: http://www.Friday.com/friday/
# Created Time : 2023-05-22 13:18:20
# Description:
#########

最低0.47元/天 解锁文章
3328

被折叠的 条评论
为什么被折叠?



