shell
tryyourbest0928
这个作者很懒,什么都没留下…
展开
-
docker日志/var/lib/docker/containers/json.log清理
docker 日志原创 2022-06-22 15:54:17 · 1164 阅读 · 0 评论 -
for+if+var
grep -n ^_id mongo.txt | awk -F: '{print $1}' > num.txttable_count=`cat -n tables.txt | awk '{print $1}' | tail -n 1`target_row_count=`wc -l num.txt | awk '{print $1}'`for ((i=1; i<=$target_row_count; i++));do for ((j=1; j<=$table_count; j原创 2021-09-23 13:38:13 · 63 阅读 · 0 评论 -
批量---多行文件按需插入指定各行
#! /bin/sh grep -n ^_id pinsurvey-mongo.txt | awk -F: '{print $1}' > num.txttarget_row_num=`cat num.txt`tables_name=`cat pinsurvey_tables.txt `table_count=`cat -n pinsurvey_tables.txt | awk '{print $1}' | tail -n 1`target_row_count=`wc -l num.tx原创 2021-09-22 14:55:43 · 98 阅读 · 0 评论 -
ansible使用shell&script模块批量初始化机器
# 连接节点安装ansibleyum -y install epel-releaseyum -y install ansible# 配置 mv /etc/ansible/ansible.cfg /etc/ansible/ansible.cfg.defaultvim /etc/ansible/ansible.cfg[defaults]inventory = /etc/ansible/hostslibrary = /usr/share/my_modules/#modu原创 2021-09-14 11:18:20 · 173 阅读 · 0 评论 -
大文件上传下载
# 大文件拆分root@monitor-alarm:/home/gitlab-runner# cat chang_cong20210707162437.sql.tgz | split -b 2G - chang_cong20210707162437.sql.tgz.root@monitor-alarm:/home/gitlab-runner# ls -ltotal 9054464-rw-r--r-- 1 gitlab-runner gitlab-runner 4635876144 Jul 7 1原创 2021-07-08 11:07:56 · 79 阅读 · 0 评论 -
mysql增量与全量备份亲测有效
前提# 看你的mysql当前默认的存储引擎:mysql> show variables like '%storage_engine%';+---------------------------------+-----------+| Variable_name | Value |+---------------------------------+-----------+| default_storage_engine |.原创 2021-01-15 15:02:23 · 250 阅读 · 0 评论 -
git shell docker常用命令
# git# 下载git clone --branch dev --single-branch --depth=1 [email protected]:pinsurvey/pinsurvey_front.git# 更新git pull --> git add file --> git commit -m "update" --> git push file# docker# 仅获取docker id【quiet】docker ps -q # 删除exis原创 2020-12-31 16:31:10 · 129 阅读 · 0 评论 -
Error response from daemon: conflict: unable to delete 10cc881966cf (must be forced)
root@ctdnad21:~# docker rmi 10cc881966cfError response from daemon: conflict: unable to delete 10cc881966cf (must be forced) - image is referenced in multiple repositories#docker rmi -f `docker images | awk '{print $1 ":" $2}'`原创 2020-12-31 15:39:01 · 111 阅读 · 0 评论 -
shell 脚本获取指定时间
DATE=`date -d yesterday +%Y_%m_%d` echo $DATE2020_11_30[root@xxx]# DATE=`date -d '1 month ago' +%Y_%m_%d`[root@xxx]# echo $DATE2020_11_01修改描述即可获得指定时间原创 2020-12-01 11:30:47 · 388 阅读 · 0 评论 -
ecs数据上传至oss实现数据备份
阿里云文档参考:https://help.aliyun.com/knowledge_detail/39584.html?spm=5176.11065259.1996646101.searchclickresult.fd703874yec7wFossutil文档(ecs文件上传至oss,文件不同步):https://help.aliyun.com/document_detail/120075.html?spm=a2c4g.11186623.6.847.1e802b69KLY6NSossfs文档(ecs原创 2020-11-27 17:50:52 · 797 阅读 · 0 评论 -
shell安装node-exporter+cadvisor+process-exporter
安装node-exporter监控系统:sh monitor.sh node-exporter安装cadvisor监控容器:sh monitor.sh cadvisor安装process-exporter监控进程(本文件仅监控nginx,按需添加):sh monitor.sh process-exporter[root@xxxx ~]# cat monitor.sh#! /bin/shif [ $1 = "node-exporter" ];then node-exporter install原创 2020-11-11 17:22:17 · 422 阅读 · 0 评论 -
查询系统ha是否自启动
ha机器数量较多且系统不定,故做此脚本做自启动状态检测import os'''linux系统信息获取,注意空格的删除,否则信息不匹配无法执行执行前做好linux命令验证工作,确保脚本正常执行'''def fun(): system_version7 = "sudo cut -c 22 /etc/redhat-release" system_version6 = "s...原创 2020-05-08 14:50:59 · 270 阅读 · 0 评论