59.定时输出cpu状态

发表于 linux 分类,标签:
#!/bin/bashnow=`date -u -d"+8 hour" +'%Y-%m-%d %H:%M:%S'`#cpu使用阈值cpu_warn='75'#mem空闲阈值mem_warn='100'#disk使用阈值disk_warn='90'#---cpuitem_cpu () {cpu_idle=`top -b -n 1 | grep Cpu | awk '{print $8}'|cut -f 1 -d "."`cp...

58.http代理无css

发表于 linux 分类,标签:
# HTTPS server  server {       listen 80;#       listen 443 ssl;   #SSL协议访问端口号为443。此处如未添加ssl,可能会造成Nginx无法启动。       server_name m.leiuk.com;  #将localhost修改为您证书绑定的域名,例如:www.example.com。#     &...

57.自动登录脚本

发表于 linux 分类,标签:
#!/bin/bashdata=`date +%F`/usr/bin/expect <<-EOFset time 30spawn scp root@120.55.46.175:/data/mysql_backup/$data.sql.gz  /data/bigmysql/big175expect {"*yes/no" { send "yes\r"; exp_continue }"*password:" { send "H8^eD4^kE5!h\r" }}expect eof...

51.yum安装zabbix4.4

发表于 linux 分类,标签:
yum安装zabbix1.确保防火墙,selinux已经关闭#systemctlstopfirewalld#systemctldisablefirewalld#sed-i's/SELINUX=enforcing/SELINUX=disabled/g'/etc/selinux/config#setenforce02.修改用户资源限制vim/etc/security/limits.confrootsoftnofile65535roothardnofile65535*softnproc65535*hardnproc65535*softnofile65535*hardnofile65535*hardcoreunlimited*softcoreunlimited 3.安装zabbixyum源rpm...

50.root修改默认端口

发表于 linux 分类,标签:
1.创建新用户并修改密码;useraddleipasswdlei2.修改ssh配置文件;vim/etc/ssh/sshd_configPort10260AllowUsersleiPermitRootLoginyes3.重启ssh。servicesshdrestart/etc/init.d/sshdrestartsystemctlrestartsshd...

49.lab_top.py

发表于 linux 分类,标签:
1.安装python3,版本3.10.5,选择添加变量2.安装vcode,版本1.69.03.安装chromedrive,下载地址:https://sites.google.com/chromium.org/driver/,一定要和浏览器版本对应4.在vscode中安装:pipinstallselenium5.D:\chromedriver_win32\chromedriver.exefrom doctest import masterfrom logging import rootfrom msilib.schema import MsiAssembly, MsiAssemblyNamefrom selenium import webdrive...

48.Linux日志文件移动或删除方法

发表于 linux 分类,标签:
日志文件移动将当前路径下的所有以.log结尾的日志移动到/tmp/logs$find./-name"*.log" |xargs-imv{}/tmp/logs/$mv`find./-name"*.log"`/tmp/logs $find./-name"*.log"-execmv{}/tmp/logs/\;日志文件删除操作将当前路径下的所有以.log结尾的日志文件删除$find./-name"*.log"|xargs rm $rm-rffind./-name"*.log" $find./-name"*.log"-execrm-rf{}\...

47.使用Supervisor来守护我们的服务

发表于 linux 分类,标签:
一、Supervisor简介Supervisor是什么?Supervisor官网(http://supervisord.org/)上是这样描述的:Supervisor是一个进程控制系统,可以用来监视并控制类UNIX系统上服务的进程。Supervisor能做什么?当服务进程意外停止时,能让服务自动完成重启,确保服务一直处于运行状态。Supervisor能解决什么问题?可以将生产中需要长期运行且运行模式是非守护进程(daemonize)的服务托管在Supervisor上,如自研发的C、java、python等服务进程以及用于监控收集数据的服务进程都可以交由Supervisor来管理。二、安装并启动Supervisor1、Supervisor的rpm包位于epel源中,所以安装supervisor前需要先安装epel-release#yum-yinstallepel-release#...

45.Linux下CPU使用率计算说明

发表于 linux 分类,标签:
usertime(us)表示CPU执行用户进程所消耗的时间。systemtime(sy)表示CPU在内核运行的时间,该值较大时表明系统存在瓶颈。waittime(wa) 表示CPU在等待I/O操作完成所花费的时间,该值较大时表明系统I/O存在瓶颈。idletime(id)CPU处于空闲状态,等待进程运行。nicetime(ni)表示在调整进程优先级时所花费CPU时间。irqtime(hi)表示在处理硬中断时所花费CPU时间。softirqtime(si)表示在处理软中断时所花费CPU时间。stealtime(st)表示Hypervisor在为另一个虚拟处理器提供服务时,虚拟CPU等待实际CPU的时间百分比。该种情况通常是在虚拟化或公有云环境存在CPU资源严重超卖的情况,多个虚拟机抢占CPU激烈。...

44.Denyhosts防止ssh暴力破解

发表于 linux 分类,标签:
1、下载解压安装wgethttps://nchc.dl.sourceforge.net/project/denyhosts/denyhosts/2.10/denyhosts-2.10.zipunzipdenyhosts-2.10.zipcddenyhosts-2.10pythonsetup.pyinstall2、修改配置 cat/etc/denyhosts.conf|grep-v"^#"|grep-v"^$"   ############THESESETTINGSAREREQUIRED############SECURE_LOG=/var/log/secureHOSTS_DENY=/etc/hosts.denyPURGE_DENY=8hBLOCK_SERVI...