一键安装dns主从服务器
摘要:一键安装dns主从服务器 #!/bin/bash firwalld_stop(){ systemctl stop firewalld setenforce 0 } yum_install(){ yum install bind bind-chroot bind-utils -y } sed_chan
阅读全文
grep sed awk
摘要:grep grep 是linux 中最常用的“文本处理工具之一” 与sed awk 合称为linux中的三剑客! grep 就像你在windows中打开txt文件,使用快捷键“Ctrl+F” 在文本中查找某个字符串一样,可以把grep 理解为字符查找工具 grep 的全程为Global search
阅读全文
使用expect ftp 免交互上传文件
摘要:防火墙关掉! 1 安装expect命令 yum -y install expect 2 vim ftp_upload.sh #!/usr/bin/expect spawn ftp localhost #执行ftp命令 expect "Name*" #如果出现Name字符 send "ftp\n" #
阅读全文
shell 一键部署 zabbix 4.0
摘要:shell 一键部署 zabbix 4.0 #!/bin/bash #关闭防火墙,关闭selinux systemctl stop firewalld setenforce 0 #配置yum源 rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86
阅读全文
shell 检测keepalived+nginx
摘要:shell 检测keepalived+nginx #!/bin/bash check(){ for server in nginx keepalived do pidof $server if [ $? -eq 0 ]; then echo "$server is ok" else echo "$s
阅读全文
shell 入侵检测与邮件告警
摘要:shell 入侵检测与邮件告警 #!/bin/bash webdir=/var/www/html cd $webdir#方法1 MD5sum校验 #md5sum /var/www/html/index.html >/opt/webfile.db md5sum -c --quiet /opt/webf
阅读全文
shell 防ddos
摘要:shell 防ddos 案例1 通过封禁ip来解决ddos 获取连接数最多的前10个ip并临时写入文件dropip中 通过for循环来遍历dropip文件的ip 排除192.168开头和127.0开头的ip 然后遍历及排除完3题的ip后调用防火墙drop掉 并写日历文件到/var/log/ddos中
阅读全文
shell 日常巡检
摘要:shell 日常巡检 #!/bin/bash ###系统信息######### os_system(){ os_type=$(uname) echo "操作系统的类型: ${os_type}" os_ver=$(cat /etc/redhat-release) echo "操作系统的版本号:${os
阅读全文
shell 检测mysql 主从状态
摘要:在从上执行: [root@master ~]# cat check_master_slave_status.sh #!/bin/bash check(){ list=($(mysql -uroot -p123456 -S /tmp/mysql.sock2 -e "show slave status\
阅读全文
shell expect 免交互操作
摘要:shell expect expect的核心是spawn、expect、send、set。 spawn调用要执行的命令 expect监听交互输出 send进行交互输入 set设置变量值 interact交互完后,将控制权交给控制台 expect eof,与spawn对应,表示捕捉终端输出信息终止,类
阅读全文
shell 脚本检测网站存活
摘要:#!/bin/bash . /etc/init.d/functions check_fun(){ url_list=(www.baidu.com www.youku.com www.tudou.com www.xxxxxx55555555555555555555555xxxxxxxxxx.com)
阅读全文
shell 复习
摘要:#! 是一个约定的标记,它告诉系统这个脚本需要什么解释器来执行,即使用哪一种 Shell shell 变量: name=”hauzai007” echo $name 注意事项: 变量名和等号之间不能有空格 不能使用标点符号 不能使用bash里的关键字 只读变量: name=”huazai007” 关
阅读全文