grep -wvf /etc/cron.weekly/namespacelist /etc/cron.weekly/namespacelist.new > /etc/cron.weekly/namespacelist.del
busybox使用方式1、上传busybox工具到/usr/bin目录修改执行权限chmod777/usr/bin/busybox2、运行busyboxtop可以看到隐藏的占用CPU的进程,原始的top可能已经被修改,不能显示病毒的进程,必须在busybox中执行下载https://gaoyuan-clb-test-1257166515.cos.ap-guangzhou.myqcloud.com/
convert/bin/sh-c"serverstart"toserverstartif[$#-gt1]&&[x"$1"=x"/bin/sh"]&&[x"$2"=x"-c"];thenshift2eval"set--$1"fi....exec&qu
dockerinspect-f'{{.GraphDriver.Data.DeviceName}}{{.Config.Labels}}'$(dockerps-a-q)|grep90bcca6ba8f75f471184ffce6a7f44135eb0199ebc707a7f86becacceb16ce9b|grepio.kubernetes.pod.name
set-eset-opipefaila(){123echo'ok'}b(){ifa;thenecho'ok'elseecho'okk'fia||echo'ok'a}bb函数3种调用方式,a函数执行的结果不同
#!/bin/bash#podName=$(dockerinspect847c1a42ba43|awk-F"[\"]*"'/"io.kubernetes.pod.name":/{print$4}'podName(){dockerinspect$1|awk-F"[\"]*"'/"io.k
ifconfigeth0|grep-oP"inet\K([0-9]{1,3}[.]){3}[0-9]{1,3}"
crontab
vim/etc/sysctl.conf#修改参数如下:net.ipv4.tcp_keepalive_time=1200net.ipv4.tcp_keepalive_probes=5net.ipv4.tcp_keepalive_intvl=15net.ipv4.tcp_max_syn_backlog=16384net.core.somaxconn=65535net.ipv4.tcp_tw_reuse
#!/bin/bashname=hostnameETH1=""ififconfigeth1&>/dev/null;thenETH1=$(ipa|grep-A0"eth1"|awk-F"[/]"'/inet/{print$3}')fiETH0=$(ipa|grep-A0"eth0"|awk-
#!/bin/bashtomcatcheck(){statusNum=200contentmin=100000statusnum=$(curl-Iwww.mayi.com2>/dev/null|awk'/HTTP/{print$2}')contentsize=$(curl-Iwww.mayi.com2>/dev/null|awk'/Content-Length/
awk '$1 ~ /^D/{cmd="rm -rf /data/www/"$2;system(cmd)}' /data/www/svnupdate.log
[root@xml-datacenterGroup01-01 ~]# less test.sh #!/bin/basha=1su - lvguanjia << ABCa=2echo $a $1ABCsu - lvguanjia << ABCa=2echo \$a $1ABCsu - lvguanjia << "ABC"a=3echo $a one:\$1&nbs
su -s /bin/sh -c /mydata/bin/startup.sh admin
#!/bin/bashTMP=truewhile ${TMP} do echo "1: svnserver 1.7" echo "2: svnserver 1.8" echo "3: svnserver 1.9" rea
在做shell批处理程序时候,经常会涉及到字符串相关操作。有很多命令语句,如:awk,sed都可以做字符串各种操作。 其实shell内置一系列操作符号,可以达到类似效果,大家知道,使用内部操作符会省略启动外部程序等时间,因此速度会非常的快。 一、判断读取字符串值表达式 含义${var}变量var的值, 与$var相同${var-DEFAULT}如果var没有被声明, 那么就以$DEFAU
详情见附近
#!/bin/bashdeclare -A APPPORTAPPPORT=([zhaocancan]=159****1876)for key in ${!APPPORT[*]}do echo $key phone is ${APPPORT[$key]}done#zhaocancan phone is 159****1876
less 1a=/nihao/hao,/woshi/xing/,/zhende/sfd/xcvless 1 | grep 'a' |awk -F "[ =,]*" '{for(i=2;i<=NF;++i) printf $i " "}'| xargs mkdir -p获取变量a的值,根据“,”分割创建目录
#!/bin/bashwhile truedo badip=$(lastb -i -a | awk '/ssh:notty/ {print $NF}'|sort|uniq -c|awk '($1>3) {print $2}') for i in $badip do iptables -t filter -I INPUT -s $i -p tcp --dport 22 -j DROP don
#!/bin/bashrm ./conf/vhost/*domainok(){domain=""while read hostdo domain=$(echo -e ${domain} ${host})done < $1echo ${domain}}dos2unix /usr/local/nginx/download/squid.confdos2unix /usr/
while read -u3 i && read -u4 j;do echo $i $j done 3<afile 4<bfileread -u3 i 的意思是从 3 号 fd&
[root@S238059 ~]# less 1.sh #!/bin/bashfor i in $(seq 0 $#)do echo ${!i}done[root@S238059 ~]# ./1.sh a b./1.shab
#!/bin/bashnetworknum(){rx1=$(ifconfig $1|grep "RX bytes"|awk '{print $2}'|awk -F: '{print $2}')sleep $2rxa=$(($rx1 / 1024))rx2=$(ifconfig $1|grep "RX bytes"|awk '{print $2}'|awk -F: '{print $2}')rxb=
1、首先在iptables里面加入此服务的端口 例如统计80端口的出流量,在OUTPUT里面加入80端口策略2、#!/bin/shwhile (true)dologtime=`date +%Y-%m-%d`a=$((`iptables -nxvL | awk '{if ( $2 == "OUTPUT") {print $7}}'`/1024))sleep 5b=$((`ip
old:auto loiface lo inet loopbackauto eth1iface eth1 inet static address 10.0.13.13 netmask 255.255.255.0auto br0 iface
#!/bin/bashfunction read_dir() { for file in `ls $1` do if [ "`ls -A $1"/"$file`" != "" -a -d $1"/"$file ] then &
#!/bin/bashls /vm/vm/ | grep -o -P '[Ss]\d{6}' > /tmp/vmlistps aux >|/tmp/pslistwhile read linedo du -sh /vm/vm/$line/data.img | awk '{print $1}' >/tmp/disktmp grep
[root@localhost ~]# ./b.sh a1b2c3[root@localhost ~]# less b.sh #!/bin/shexec < bzcc(){ echo $1 echo&n
lessa.sh#!/bin/shfilename=$1size=$2if[!-d$filename];thenecho"youmustenterlibraryname"exit1fils-l$filename|sed'1d'|awk'{print$5,$9}'>/tmp/file.sizewhilereadxdoif[`echo$x|awk'{print$1}'`-gt$size];the
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号