随笔分类 -  运维

运维
摘要:ansible-playbook ansible-playbook执行脚本,并输出到控制台 - name: Deploy nginx logrotate.sh and print the result hosts: all become: yes # 如果需要以root权限执行命令,则需要这一行 t 阅读全文
posted @ 2024-07-26 14:16 SpecialSpeculator 阅读(4) 评论(0) 推荐(0) 编辑
摘要:shell脚本中if条件的判断 1.可以直接判断命令是否执行成功 if /usr/bin/wget -q -O ${script_location} ${download_url}; then chmod +x "${script_location}" echo "部署切割脚本 [完毕]" else 阅读全文
posted @ 2023-12-27 14:47 SpecialSpeculator 阅读(21) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash # utf-8 # description: 部署nginx_lograte.sh脚本 # script_name="logrotate_new.sh" script_download_directory="http://172.20.147.61/CentOS/app/sc 阅读全文
posted @ 2023-12-27 14:45 SpecialSpeculator 阅读(8) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash # utf-8 # description: nginx滚动切割脚本,按照500M进行滚动切割 # log_directory="/export/servers/nginx/logs" # 日志文件目录 max_size=500 # 日志文件的最大大小,单位为MB log_a 阅读全文
posted @ 2023-12-18 16:14 SpecialSpeculator 阅读(48) 评论(0) 推荐(0) 编辑
摘要:cpu飚高分析 #!/bin/bash # utf-8 # description: 分析java进程cpu飚高,打出具体的线程栈 # get javaHome function GetJavaHome(){ javaHome=$(ps -ef | grep java | grep -v jcoll 阅读全文
posted @ 2023-11-09 14:46 SpecialSpeculator 阅读(7) 评论(0) 推荐(0) 编辑
摘要:cpuhighanalysis.py #!/usr/bin/env python # -*- coding=utf-8 -*- ############################ import os import sys import commands import time status,o 阅读全文
posted @ 2023-11-08 17:52 SpecialSpeculator 阅读(5) 评论(0) 推荐(0) 编辑
摘要:磁盘坏道检测脚本 说明: hp服务器有一定概率执行命令会卡主, #!/bin/bash # utf-8 # 说明: 其他型号服务器获取raid信息通过MegaCli # 说明: HP服务器获取raid信息通过hpacucli # 安装包信息定义 HP_SSACLI_COMMAND_RPM_NAME= 阅读全文
posted @ 2023-09-26 15:58 SpecialSpeculator 阅读(21) 评论(0) 推荐(0) 编辑
摘要:shell脚本中的变量 局部变量 local 修饰,作用域在函数里,当出现同名变量优先级高于外部全局变量 全局变量 全局变量,不加任何修饰符,一般用于定义常量,任何函数体里都可以直接去取全局变量的值 阅读全文
posted @ 2023-09-11 14:03 SpecialSpeculator 阅读(27) 评论(0) 推荐(0) 编辑
摘要:重建rpm本地库 /bin/rm -f /var/lib/rpm/.dbenv.lock /bin/rm -f /var/lib/rpm/.rpm.lock /bin/rm -rf /var/lib/rpm/__db.00* rpm --rebuilddb 阅读全文
posted @ 2023-09-11 14:00 SpecialSpeculator 阅读(28) 评论(0) 推荐(0) 编辑
摘要:1.case语句 可以实现switch case的逻辑 case $server_vendor in "HP"|"Hewlett-Packard") install_rpm "HP" hp_server_hardware_health_check ;; *) install_rpm "Other" 阅读全文
posted @ 2023-09-11 13:59 SpecialSpeculator 阅读(8) 评论(0) 推荐(0) 编辑
摘要:# 脚本修改admin账户的crontab 其实就是修改/var/spool/cron/admin文件内容 且修改后不用重新加载就可以生效 阅读全文
posted @ 2023-07-12 17:34 SpecialSpeculator 阅读(22) 评论(0) 推荐(0) 编辑
摘要:1.内容匹配行首注释 /bin/sed -i "s/^[^#].*jdfalcon_agent*/#&/g" /etc/crontab #: s:替换 #: ^:开头匹配 #: [^#]:匹配非# #: #&:中的&代表匹配整行,整个意思就是行前面加上#号 #: g:全部(只匹配特定行不加) 1.1 阅读全文
posted @ 2023-07-12 16:40 SpecialSpeculator 阅读(18) 评论(0) 推荐(0) 编辑
摘要:# 匹配包中http的包,并且header头X-Forwarded-For中是172开头的 ``` http contains "X-Forwarded-For: 172" ``` 阅读全文
posted @ 2023-05-24 11:28 SpecialSpeculator 阅读(50) 评论(0) 推荐(0) 编辑
摘要:将互信扔到对方机器上,可以免密登录 172.20.137.60是堡垒机,authronized_key是秘钥文件 cd /root/.ssh/ && \rm authorized_keys && wget http://172.20.147.60/software/authorized_keys 阅读全文
posted @ 2023-03-09 16:03 SpecialSpeculator 阅读(65) 评论(0) 推荐(0) 编辑
摘要:1.将 远程机器的目录拽到本地目录 将11.127.124.67机器的/mnt/root/export/目录拽到本地目录/mnt/export/11.127.124.67.export 备注:前目录有/结尾,后目录结尾不带/ rsync -aP --rsh=ssh 11.127.124.67:/mn 阅读全文
posted @ 2023-03-08 10:43 SpecialSpeculator 阅读(98) 评论(0) 推荐(0) 编辑
摘要:本地临时起一个tcp端口,用于测试是否可行 nc -l 22000 阅读全文
posted @ 2023-02-02 15:15 SpecialSpeculator 阅读(14) 评论(0) 推荐(0) 编辑
摘要:共享库文件缺失 报错 Stopping keepalived: [FAILED] Starting keepalived: /export/servers/keepalived-1.2.13/sbin/keepalived: error while loading shared libraries: 阅读全文
posted @ 2022-09-08 09:09 SpecialSpeculator 阅读(447) 评论(0) 推荐(0) 编辑
摘要:tcp重传排查 执行命令 tcpdump -i eth0 tcp and port 22 -C 20 -W 50 -w /tmp/cap.pcap 说明: 抓取eth0的tcp报文,且端口为22的,最大抓取50个包,每个包20M,共占用1G的空间, 抓取的文件保存到/tmp/cap.pcap下。 对 阅读全文
posted @ 2022-06-06 00:13 SpecialSpeculator 阅读(155) 评论(0) 推荐(0) 编辑
摘要:1. yum 安装vsftpd yum install vsftpd -y 2.替换配置文件 /etc/vsftpd/vsftpd.conf anonymous_enable=YES local_enable=YES write_enable=YES local_umask=022 dirmessa 阅读全文
posted @ 2022-03-24 15:47 SpecialSpeculator 阅读(63) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示