撇嘴看天空

导航

2019年6月13日

linux 自动检查ssh脚本

摘要: check_ssh.sh #!/bin/bash #*/5 * * * * /home/check_ssh.sh process_day=`date -d today +"%Y-%m-%d %H:%M"` process=`ps -ef | grep -v 'grep' | grep "\<sshd 阅读全文

posted @ 2019-06-13 19:32 撇嘴看天空 阅读(254) 评论(0) 推荐(0) 编辑

删除linux访问记录(message删不了)

摘要: deljil.sh ckmsce=/home/deljl.exp aa=root bb=123456 omplist=" 192.168.1.14 192.168.1.15 192.168.1.16 192.168.1.17 192.168.1.18 192.168.1.19 192.168.1.2 阅读全文

posted @ 2019-06-13 19:28 撇嘴看天空 阅读(257) 评论(0) 推荐(0) 编辑

h3c 备份脚本

摘要: #!/bin/bash#0 0 1,10,22 * * /it_data3/h3c_backup.sh & #添加到计划任务 datetime=`date +%Y%m%d` BAKTIME=`date +%Y%m%d%H%M%S` user="admin" password="123456" bac 阅读全文

posted @ 2019-06-13 19:23 撇嘴看天空 阅读(153) 评论(0) 推荐(0) 编辑

linux 批量scp 脚本

摘要: scp.sh #!/bin/ship_list=/home/tools/scp/iplistsrc_file=/home/probecheck.shdest_file=/home/username=rootpassword=123456cat $ip_list | while read linedo 阅读全文

posted @ 2019-06-13 19:20 撇嘴看天空 阅读(420) 评论(0) 推荐(0) 编辑

Linux 删除几天前的文件脚本

摘要: #!/bin/bash filePath=/it_data2/ filePath1=/it_data3/cd $filePath ls filename1* -lrt --time-style="+%Y-%m-%d %H:%M %z" | awk '{print $6,$7,$9;}' | whil 阅读全文

posted @ 2019-06-13 19:17 撇嘴看天空 阅读(239) 评论(0) 推荐(0) 编辑

博达交换机镜像检查,镜像丢失自动添加脚本

摘要: check_bd_mirr.sh #!/bin/bash #/home/tools/check_tools/cfg_bd_mirror/check_bd_mirr.sh #所在目录文件名process_day=`date -d today +"%Y-%m-%d %H:%M:%S"` cd /home 阅读全文

posted @ 2019-06-13 19:12 撇嘴看天空 阅读(309) 评论(0) 推荐(0) 编辑

linux 批量升级openssh8.0

摘要: updateopenssh.sh explujing=/home/updateopenssh.exp username=root password=123456 iplist="192.167.1.94192.167.1.95192.167.1.96192.167.1.97" port=22 for 阅读全文

posted @ 2019-06-13 19:06 撇嘴看天空 阅读(314) 评论(0) 推荐(0) 编辑

linux 批量关闭telnet

摘要: shutdown_telnet.sh explujing=/home/shutdown_telnet.exp username=root password=123456 iplist="192.167.1.1 192.167.1.2 " port=22 for ip in $iplist do $e 阅读全文

posted @ 2019-06-13 19:00 撇嘴看天空 阅读(168) 评论(0) 推荐(0) 编辑

linux 批量安装telnet脚本

摘要: install_telnet.sh explujing=/home/install_telnet.exp username=root passwd=123456 iplist="192.167.1.1192.167.1.2192.167.1.3 " port=23 for ip in $iplist 阅读全文

posted @ 2019-06-13 18:55 撇嘴看天空 阅读(260) 评论(0) 推荐(0) 编辑

批量添加linux 定时任务crontab -e

摘要: 脚本如下 crontab_add.sh explujing=/home/crontab_add.exp username=rootpassword=123456 iplist="192.168.3.101 192.168.3.102"port=22for ip in $iplistdo $explu 阅读全文

posted @ 2019-06-13 18:47 撇嘴看天空 阅读(1110) 评论(0) 推荐(0) 编辑

linux 实现excel vlookup

摘要: 脚本内容 vlookup.sh #!/bin/bashawk 'NR==FNR{a[$1]=$0;next}NR>FNR{if($1 in a)print $0"\t"a[$1]}' $1 $2 >vlookup_result [root@localhost/home/]#cat aa1 a e2 阅读全文

posted @ 2019-06-13 18:00 撇嘴看天空 阅读(1713) 评论(0) 推荐(0) 编辑

Shell脚本编程

摘要: shell脚本 Shell脚本编程 1shell脚本--简介 1.1格式要求:首行shebang(sharp bang)<==>#!机制 ​ #!/bin/bash(用于shell脚本) ​ #!/usr/bin/python(用于python脚本) ​ #!/usr/bin/perl(用于perl 阅读全文

posted @ 2019-06-13 16:14 撇嘴看天空 阅读(300) 评论(0) 推荐(0) 编辑

SHELL脚本--read命令

摘要: 1.1 shell read简介 要与Linux交互,脚本获取键盘输入的结果是必不可少的,read可以读取键盘输入的字符。 shell作为一门语言,自然也具有读数据的功能,read就是按行从文件(或标准输入或给定文件描述符)中读取数据的最佳选择。当使用管道、重定向方式组合命令时感觉达不到自己的需求时 阅读全文

posted @ 2019-06-13 16:11 撇嘴看天空 阅读(16919) 评论(1) 推荐(1) 编辑

SHELL脚本--数学运算和bc命令

摘要: 使用let、(())、$(())或$[]进行基本的整数运算,使用bc进行高级的运算,包括小数运算。其中expr命令也能进行整数运算,还能判断参数是否为整数,具体用法见expr命令全解。 其中let和(())几乎完全等价,除了做数学运算,还支持数学表达式判断,例如数值变量a是否等于3:let a==3 阅读全文

posted @ 2019-06-13 16:11 撇嘴看天空 阅读(1233) 评论(0) 推荐(0) 编辑

Linux中使用 if 、for、while等循环来写脚本

摘要: 这次来介绍一下Shell的基本语法: 一、注释 Shell中的注释标志是井号 "#",除了脚本文件第一行的#不是注释之外,其他地方出现#,则说明#开始,到本行的末尾都是注释 二、指定脚本解释器 一般每个Shell脚本文件的第一行都是指定脚本解释器 #!/bin/bash : 指定本脚本文件使用bas 阅读全文

posted @ 2019-06-13 16:03 撇嘴看天空 阅读(1169) 评论(0) 推荐(0) 编辑

linux for 循环

摘要: 循环结构(for)for 变量名 in 列表do? 循环体done列表生成方式:(1) 直接给出列表(2) 整数列表:? (a) {start..end}? (b) $(seq [start [step]] end)(3) 返回列表的命令? $(COMMAND)(4) 使用glob,如:*.sh(5 阅读全文

posted @ 2019-06-13 15:58 撇嘴看天空 阅读(1616) 评论(0) 推荐(0) 编辑

linux shell case

摘要: 条件结构(case)case 变量引用 in PAT1) 分支1;; PAT2) 分支2;; ... *) ;; esaccase支持glob风格的通配符:? *: 任意长度任意字符? ?: 任意单个字符? []:指定范围内的任意单个字符? a|b: a或b9.2.1小试牛刀-case实例#模拟系统 阅读全文

posted @ 2019-06-13 15:53 撇嘴看天空 阅读(121) 评论(0) 推荐(0) 编辑

linux shell脚本 if eles

摘要: 条件结构(if)if 判断条件;then 条件为真的分支代码fi一切都以返回状态码是否为0为判决条件。如果执行结果的退出状态码为0,执行,不然就执行else部分小试牛刀-if-else实例#交互式判断年龄大于50为old man,小于等于50位young man#!/bin/bashread -p 阅读全文

posted @ 2019-06-13 15:51 撇嘴看天空 阅读(296) 评论(0) 推荐(0) 编辑

tr 压缩命令

摘要: tr: tr [options] [SET1] [SET2] 处理输入信息的(转换和删除字符串的,后换前); 默认是键盘输入,所以你输入tr,跟cat同理,都是等待键盘的输入的;所以tr和cat也可能利用<(输入重定向来)来接收文件的信息; 参数: -t:截断,使得SET1的长度和SET2的长度相同 阅读全文

posted @ 2019-06-13 15:48 撇嘴看天空 阅读(584) 评论(0) 推荐(0) 编辑

杀掉死循环脚本

摘要: ps auxf|grep '脚本名'|grep -v grep|awk '{print $2}'|xargs kill -9 阅读全文

posted @ 2019-06-13 15:45 撇嘴看天空 阅读(145) 评论(0) 推荐(0) 编辑