随笔分类 - Scripts
摘要:#!/bin/bash # 文件名: show_cpu_usage.sh # 作者: wanghongwei # 日期: 2025年1月20日 # 版本: 1.0 # 描述: 统计进程 CPU 使用率并按使用率从大到小排序 # 使用方式:./show_cpu_usage.sh [-i interva
阅读全文
摘要:#!/bin/bash # 文件名: show_memory.sh # 作者: wanghongwei # 日期: 2024年9月29日 # 版本: 1.0 # 描述: 统计进程内存使用量 # 使用方式: ./show_memory.sh [-k/-K] [-m/-M] [-g/-G] # 初始化所
阅读全文
摘要:#!/bin/bash # 文件名: show_hugepage.sh # 作者: wanghongwei # 日期: 2024年9月29日 # 版本: 1.0 # 描述: 统计进程大页内存使用量 # 使用方式: ./show_hugepage.sh [-k/-K] [-m/-M] [-g/-G]
阅读全文
摘要:监控目录并捕获操作文件的程序信息 /* * 文件名: file_monitor.c * 作者: wanghongwei * 日期: 2024年9月28日 * 版本: 1.0 * 描述: 监控目录并捕获操作文件的程序信息 * 使用方式: ./file_monitor <directory_to_mon
阅读全文
摘要:服务端 # -*- coding: utf-8 -*- import socket import threading HOST = '0.0.0.0' PORT = 12345 def handle_client(conn, addr): print "连接地址:", addr try: while
阅读全文
摘要:change_rdsport_CN.bat(支持Windows2003, 2008, 2008R2, 2012, 2012R2, 7, 8, 10) @echo off color f0 echo 修改远程桌面3389端口(支持Windows2003, 2008, 2008R2, 2012, 201
阅读全文
摘要:kolla-ansible提供的一键式创建示例网络、图像等,不得不说,真的是太贴心了!只需根据实际环境修改公共网络和租户网络部分。 #!/bin/bash set -o errexit # This script is meant to be run once after running start
阅读全文
摘要:批量导出 #!/bin/bash # 设置导出镜像的目录 EXPORT_DIR="/root/images" # 确保导出目录存在 mkdir -p "$EXPORT_DIR" # 获取所有的镜像并导出 IMAGES=$(docker images --format '{{.Repository}}
阅读全文
摘要:网页正常性监控脚本 #!/bin/bash # Define lockfile and add exclusive lock LOCKFILE=/var/run/httpmonitor.lock exec 200>$LOCKFILE flock -n 200 if [ $? != 0 ]; then
阅读全文
摘要:``` # 导入paramiko模块,用于ssh连接 import paramiko # 定义一个函数,用于执行ssh命令,并返回输出结果 def ssh_command(ip, port, username, password, command): # 创建一个ssh客户端对象 ssh = par
阅读全文
摘要:``` // 设置环境变量: var jsonData = pm.response.json(); pm.environment.set("vmResourceId",jsonData.returnObj.resources[0].resourceID); // 获取环境变量: var bucket
阅读全文
摘要:``` #!/bin/bash # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as pub
阅读全文
摘要:#!/bin/bash Date=$(date +%Y%m%d) Log_File="user-${Date}.log" Log_CMD="tee -a $Log_File" UserLDIF="user-${Date}.ldif" UserWithPW="user-pw-${Date}.txt"
阅读全文
摘要:``` #!/bin/bash #OpenLDAP数据备份脚本 set -e cd $(dirname $0) echo dir=$(pwd) mkdir /data/openldap-$(date "+%Y%m%d") mkdir /data/openldap-$(date "+%Y%m%d")/
阅读全文
摘要:#!/bin/bash health_state=$(ceph -s | grep health | awk '{print $2}') inconsistent_state=$(ceph -s | grep inconsistent) damaged_pg=$(ceph health detail
阅读全文
摘要:#!/bin/bash Date=$(date +%Y%m%d) Log_File="result-${Date}.log" Log_CMD="tee -a $Log_File" custId="324c1737856149d19e027ad45e869666" Authorization="Bea
阅读全文
摘要:#! /bin/sh used=`free -m | awk 'NR==2' | awk '{print $3}'` free=`free -m | awk 'NR==2' | awk '{print $4}'` echo " " >> /var/log/memory.log date >> /va
阅读全文
摘要:CentOS 7 系统初始化配置 # step 1: 修改默认Yum源为阿里源 if [ ! -f "/etc/yum.repos.d/CentOS-Base.repo.bak" ]; then mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.
阅读全文