运维日常集合(个人向) 日常运维常用集合,分三部分 windows、linux、Python 得益于python工具便利性,使得运维的工作大大减少。 Shell 清除其他终端 找出内存消耗的进程排序 找出CPU消耗的进程排序 持续 ping 并将结果记录到日志 ping api.jpush.cn | ...
分类:
其他好文 时间:
2020-02-28 00:58:08
阅读次数:
83
adb 将当前页面的数据导出来 adb shell "uiautomator dump --compressed && cat /sdcard/window_dump.xml" shell读取坐标 cat /temp/ui.xml |sed 's#<node #^<node #g' | tr ^ ' ...
分类:
数据库 时间:
2020-02-27 20:54:51
阅读次数:
102
之前帮朋友写的脚本,运维大数据服务器时候用的。 #!/bin/bash ##磁盘数量 Disk=$( fdisk -l |grep 'Disk' |grep 'sd' |awk -F , '{print "%s",substr($1,13,1)}') var=${Disk: -1:1} echo b... ...
分类:
系统相关 时间:
2020-02-27 19:17:29
阅读次数:
124
由于过多的日志很占用磁盘空间,今天经理让我写一个脚本删除多余的日志、和es索引 定时删除试根据crontab+shell脚本实现的 crontab配置目录 /var/spool/cron/ 该目录下存放的是每个用户(包括root)的crontab任务,文件名以用户名命名 /etc/cron.d/ 这 ...
分类:
系统相关 时间:
2020-02-27 19:01:37
阅读次数:
95
package tools import ( "bufio" "errors" "fmt" "github.com/Sirupsen/logrus" "go.pkg.okcoin.com/devops/agent/internal/constant" "os/exec" "strings" ) /* ...
分类:
系统相关 时间:
2020-02-27 15:58:43
阅读次数:
154
判断文件内容是否改变: 1)md5值判断 2)diff 判断 #添加日志时间戳 function fn_showlog() { local curtime; curtime=`date +"%Y%m%d-%H:%M:%S"` echo "$curtime $1"; } #判断文件内容是否一致 fun ...
分类:
系统相关 时间:
2020-02-27 15:58:28
阅读次数:
138
环境变量配置文件 MacOS Linux 如果shell的类型是zsh时,还会存在 和`~/.zshrc`。 其中 ,`/etc/paths /etc/bashrc /etc/profile /etc/paths /etc/bashrc`在bash shell执行时,会读取该文件。 MacOS默认用 ...
分类:
其他好文 时间:
2020-02-27 14:37:14
阅读次数:
73
##move## for((i=1;i<=22;i++));do cp combine_all.split_$i split_$i;done ##gzip## mkdir gzip/workshell for((i=1;i<=22;i++));do echo "gzip split_$i"> spl ...
分类:
其他好文 时间:
2020-02-27 13:12:40
阅读次数:
60
一、变量 在myshell.sh中输入 执行: 使用set指令可以查看当前shell下的所有变量。 在myshell.sh中输入: 执行: 使用unset可以撤销一个变量。 使用readonly声明静态变量,不可以撤销该变量:readonly A=99 比如: 二、设置环境变量 在/etc/prof ...
分类:
系统相关 时间:
2020-02-27 12:57:09
阅读次数:
73
1. shell 的派生 用户登录到Linux系统后,系统将启动一个用户shell。在这个shell中,可以使用shell命令, 或声明变量,也可以创建并运行shell脚本程序。运行shell脚本程序时,系统将创建一个子shell。 此时,系统中将有两个shell,一个是登录时系统启动的shell, ...
分类:
系统相关 时间:
2020-02-27 11:34:48
阅读次数:
111