随笔分类 -  shell

shell脚本
摘要:#!/bin/bashprog=$1memfile=1.txtcpufile=2.txtwhile truedo ######################################################################## # 检查内存使用情况 # ####### 阅读全文
posted @ 2020-08-03 15:13 fives 阅读(399) 评论(0) 推荐(0)
摘要:#!/bin/bashurl=(www.baidu.com www.hah.com www.sdadadsd.com)for i in ${url[@]}doce=`curl -I -s -o /dev/null -m 10 -w %{http_code} $i`if [ $ce == 200 ]; 阅读全文
posted @ 2020-05-23 11:37 fives 阅读(133) 评论(0) 推荐(0)
摘要:#!/bin/basha=(`cat shu |grep -v "192" |grep -v "127"`)b=$(cat shu |grep "192")c=$(cat shu |grep "127")####shu是一个ip文档###for i in ${a[@]}do iptables -I 阅读全文
posted @ 2020-05-19 17:09 fives 阅读(212) 评论(0) 推荐(0)
摘要:#!/bin/basha=$((RANDOM%100))b=0echo $awhile :dolet b++read -ep "输入一个数" shu if [ $a -eq $shu ]; then echo "相等" break elif [ $a -gt $shu ]; then echo "小 阅读全文
posted @ 2020-05-19 17:07 fives 阅读(174) 评论(0) 推荐(0)
摘要:#!/bin/bashbei(){da=`date +%F`read -ep "输入指定要备份的数据库名称" filemkdir -p /opt/$damysqldump -B $file > /opt/$da/$file.sql if [ $? -eq 0 ]; thenecho "备份成功" > 阅读全文
posted @ 2020-05-19 17:06 fives 阅读(258) 评论(0) 推荐(0)
摘要:#!/bin/basha=$(mysql -e "show slave status\G" | awk '/Slave_IO_Running/ {print $2}')b=$(mysql -e "show slave status\G" | awk '/Slave_SQL_Running/ {pri 阅读全文
posted @ 2020-05-19 17:05 fives 阅读(1036) 评论(0) 推荐(0)
摘要:#!/bin/bash #系统信息###system(){ xi=$(uname) echo "操作系统 $xi " version=`cat /etc/redhat-release` echo "操作系统版本 $version" nei=`uname -r` echo "操作系统内核 $nei" 阅读全文
posted @ 2020-05-19 17:03 fives 阅读(294) 评论(0) 推荐(0)