随笔分类 -  shell |运维

摘要:配置目录大小监控 #!/bin/bash #cd /nfs1/ExternalPersonnel cd /nfs1/ExternalPersonnel capacitydata=`du -sh data |awk '{print $1}'` capacityhome=`du -sh home |aw 阅读全文
posted @ 2023-12-15 10:39 lixinliang 阅读(104) 评论(0) 推荐(0) 编辑
摘要:yum install sshpass -y sshpass -p'12345' ssh -o StrictHostKeyChecking=no root@172.18.0.59 "hostname" 阅读全文
posted @ 2019-12-13 09:42 lixinliang 阅读(378) 评论(0) 推荐(0) 编辑
摘要:#!/bin/sh ip=`cat allip` for i in $ip;do ping -c 1 $i if [ $? -eq 0 ];then num=`ssh $i "find /data/ -name py-env.tar.gz" |wc -l` if [ $num -ne 0 ];then echo $i >> yes.txt fi ... 阅读全文
posted @ 2019-10-22 12:28 lixinliang 阅读(908) 评论(0) 推荐(0) 编辑
摘要:作用: 1. 可以在执行脚本过程中免输入yes 2.可以在执行脚本过程中免输入密码 脚本内容如下: *** ipfile.txt 为主机列表 [root@YZSJHL-N1-1 opt]# cat remote.sh #!/usr/bin/expect -f #chmod 777 distribut 阅读全文
posted @ 2019-07-26 13:52 lixinliang 阅读(758) 评论(0) 推荐(0) 编辑
摘要:[yunwei@Y24-209 ~]$cat ls.sh #!/bin/bash ip55=`cat ip1` for i in $ip55;do ping -c 1 $i if [ $? -eq 0 ];then ssh -t $i "ls" if [ $? -eq 0 ];then echo -e "$i" >> ok.ip else ... 阅读全文
posted @ 2019-04-12 13:12 lixinliang 阅读(698) 评论(0) 推荐(0) 编辑
摘要:cat 1.txt src='http://img2.tgbusdata.cn/v2/thumb/jpg/MkY5Myw2NTUsMzAzLDksMywxLC0xLDAscms1MCwxOTIuMTY4LjguNjc=/u/iphone.tgbus.com/UploadFiles/201806/2018062615240983.jpg' 要求 将 http://img2.tgbus... 阅读全文
posted @ 2019-03-05 14:06 lixinliang 阅读(348) 评论(0) 推荐(0) 编辑
摘要:find . -type d -exec chmod 500 {} \; find . -type f -exec chmod 400 {} \; 阅读全文
posted @ 2019-02-26 16:32 lixinliang 阅读(527) 评论(0) 推荐(0) 编辑
摘要:[DNyunwei@YZSJHL24-209 li]$ cat port.sh #!/bin/bash # ip=`cat iplist` for i in $ip;do port=`ssh -t $i "sudo netstat -anput" |grep 19100 |awk '{print $4}' |column -x |tr '\n' '\t'` echo -e "$i \... 阅读全文
posted @ 2019-01-21 18:03 lixinliang 阅读(947) 评论(0) 推荐(0) 编辑
摘要:[DNyunwei@YZSJHL24-209 li]$ cat jia.sh #!/bin/bash ip=`cat jia.ip` for i in $ip;do HostName=`ssh -t $i "hostname"` echo -e "$i \t $HostName" >>jia.jg done #打印ip 和 主机名 阅读全文
posted @ 2019-01-21 17:57 lixinliang 阅读(2021) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash for ip in `cat a.txt`;do a=`echo $ip|awk -F '.' '{print $1}'` b=`echo $ip|awk -F '.' '{print $2}'` c=`echo $ip|awk -F '.' '{print $3}'` d=`echo $ip|awk -F '.' '{print $4}'` e=$[... 阅读全文
posted @ 2019-01-11 18:03 lixinliang 阅读(580) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash confs=`ls /etc/nginx/conf.d/cms_vhosts/` cd /etc/nginx/conf.d/cms_vhosts for log in $confs;do name=`echo ${log} |awk -F '.' '{print $1}'` sed -i "/root/a\error_log /zz_data/nginx_l... 阅读全文
posted @ 2019-01-09 17:03 lixinliang 阅读(1082) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash #在 servername 域名 字符串后面添加指定字符串 servername=`grep ServerName httpd-vhosts.conf |awk '{print $2}'` for conf in $servername;do sed -i "/ServerName $conf/a\ErrorLog "logs/${conf}_error.l... 阅读全文
posted @ 2019-01-09 16:56 lixinliang 阅读(339) 评论(0) 推荐(0) 编辑
摘要:#!/bin/sh #二代云盒-混合网 device_version=`cat /xdfapp/data/version/device` ocb_device=`cat /proc/cpuinfo |grep "J3160" |wc -l` nginx_dir="/xdfapp/backups/se 阅读全文
posted @ 2018-10-11 17:58 lixinliang 阅读(622) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash # tftp install # 20180711 # 仅测试过操作系统 ubuntu 16.04 download_url='http://img.fe.okjiaoyu.cn' packet_name='tftpd-hpa_5.2.deb' tftp_md5='6a0a441bddac2117171a1c52180a96af' ap_url='http://img... 阅读全文
posted @ 2018-10-11 17:57 lixinliang 阅读(187) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash # 20180819 #云盒服务检查脚本 result_num=0 nginx_ssl="/xdfapp/server/nginx/conf/ssl" gru_ssl="/xdfapp/apps/gru-absolute/conf/spearssl" local_ip=`ip a |grep "scope global" |grep "enp2s0" |awk '{pr... 阅读全文
posted @ 2018-08-25 18:00 lixinliang 阅读(227) 评论(0) 推荐(0) 编辑
摘要:[root@localhost test]# pwd /data/soft/test [root@localhost test]# ls 10.txt 1.txt 2.tx 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt 脚本内容: dir="/data/soft/test/*" for i in $dir;do b=... 阅读全文
posted @ 2018-07-13 15:51 lixinliang 阅读(171) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash function change_ap { ( s=`stty -g`; str=$"\n" sstr=$(echo -e $str) stty raw -echo; sleep 2; echo "xxxx"; sleep 2; echo "xxxxx"; sleep 2; echo "system-view"; sleep ... 阅读全文
posted @ 2018-07-12 10:53 lixinliang 阅读(2047) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash Ip_addr=`cat /etc/dnsrecord.txt |awk '{print $1}' |head -1` Check_dns_url(){ grep $1 /etc/dnsrecord.txt >/dev/null if [ $? -ne 0 ];then echo "${Ip_addr} $1 " >> /etc/dnsrecord.t... 阅读全文
posted @ 2018-07-11 09:41 lixinliang 阅读(425) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash function cache(){ for i in `curl xxx.fe.xxx.cn/uplist.txt`;do url=`echo $i|awk -F"#" '{print $1}'` md5=`echo $i|awk -F"#" '{print $2}'` file_name=`echo $url|awk -F'\/' '{print $NF}'... 阅读全文
posted @ 2018-07-02 10:51 lixinliang 阅读(857) 评论(0) 推荐(0) 编辑

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