方法一: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实现会话保持