方法一:nginx
[root@centos7 scripts43]#ps -eo pid,ppid,cmd,%mem,%cpu --sort -%mem|head -6
PID PPID CMD %MEM %CPU
7715 /usr/bin/gnome-shell 10.7 0.4
7715 /usr/bin/gnome-software --g 3.2 0.1
6799 /usr/bin/X :0 -background n 2.9 0.0
7715 nautilus-desktop --force 1.3 0.0
1 /usr/libexec/goa-daemon 1.3 0.0redis
方法二:docker
命令:top
使用M 對進程按照內存從大到小排序shell
配置臨時ip:
[root@centos7 ~]#ip a a dev eth0 label eth0:1 192.168.0.4/24
[root@centos6 ~]#ip a a dev eth0 label eth0:1 192.168.0.3/24vim編輯for腳本:centos
vim for_ping.shtomcat
#!/bin/bash for ((i=1;i<255;i++));do { if ping -c1 -W2 "192.168.0.${i}" &> /dev/null ; then echo 192.168.0.${i} success! >>ping_resault.txt else echo 192.168.0.${i} fail! >>ping_resault.txt fi } done
for運行結果:
bash
編輯while腳本:架構
vim while_ping.sh ide
#!/bin/bash declare -i i=1 while [ $i -lt 255 ];do { if ping -c1 -W1 "192.168.0.${i}" &> /dev/null ; then echo 192.168.0.${i} success! >>ping_resault_while.txt else echo 192.168.0.${i} fail! >>ping_resault_while.txt fi i+=1 } done
while運行結果:
1)寫計劃任務腳本:
vim /data/scripts43/crontab/crontab.sh
#!/bin/bash tar cvf /data/etcbak-\`date -d yesterday +%F-%T\`.tar.xz /etc/腳本賦權限:
[root@centos7 data]#chmod u+x /data/scripts43/crontab/crontab.sh腳本運行結果:
[root@centos7 data]# tar cvf /data/etcbak-`date -d yesterday +%F-%T`.tar.xz /etc/2)添加到crontab計劃任務中:
[root@centos7 data]#crontab -e
30 1 1-5 /data/scripts43/crontab/crontab.sh
1)寫腳本:
vim /data/scripts43/crontab/diskwall.sh#!/bin/bash PRE=80 NUM=`df |sed -nr '/^\/dev\/sd/s#.* ([0-9]+)%.*#\1#p' | sort -nr |head -1` [ "$NUM" -gt "$PRE" ] && wall disk will be full賦權限:[root@centos7 data]#chmod u+x /data/scripts43/crontab/diskwall.sh
腳本運行結果:
2)添加到計劃任務中:
[root@centos7 data]#crontab -e
/10 * /data/scripts43/crontab/diskwall.sh
架構班小夥伴看這裏:
一、使用docker安裝部署jumpserver跳板機
二、openstack rocky版keystone,glance,nova,neutron,cirros等安裝配置。
三、配置nginx反向代理tomcat,並使用redis實現會話保持