1、显示统计占用系统内存最多的进程,并排序。
方法一
[root@test ~]#ps aux --sort=%memUSER PID %cpu %MEM VSZ RSS TTY STAT START TIME COMMANDroot 2 0.0 0.0 0 0 ? S Sep20 0:00 [kthreadd]root 3 0.0 0.0 0 0 ? S Sep20 0:18 [ksoftirqd/0]root 5 0.0 0.0 0 0 ? S< Sep20 0:00 [kworker/0:0H]root 7 0.0 0.0 0 0 ? S Sep20 0:00 [migration/0]root 8 0.0 0.0 0 0 ? S Sep20 0:00 [rcu_bh]root 9 0.0 0.0 0 0 ? R Sep20 7:21 [rcu_sched]root 10 0.0 0.0 0 0 ? S< Sep20 0:00 [lru-add-drain]root 11 0.0 0.0 0 0 ? S Sep20 0:18 [watchdog/0]root 13 0.0 0.0 0 0 ? S Sep20 0:00 [kdevtmpfs]root 14 0.0 0.0 0 0 ? S< Sep20 0:00 [netns]root 15 0.0 0.0 0 0 ? S Sep20 0:01 [khungtaskd]root 16 0.0 0.0 0 0 ? S< Sep20 0:00 [writeback]root 17 0.0 0.0 0 0 ? S< Sep20 0:00 [kintegrityd]root 18 0.0 0.0 0 0 ? S< Sep20 0:00 [bioset]root 19 0.0 0.0 0 0 ? S< Sep20 0:00 [bioset]root 20 0.0 0.0 0 0 ? S< Sep20 0:00 [bioset]root 21 0.0 0.0 0 0 ? S< Sep20 0:00 [kblockd]root 22 0.0 0.0 0 0 ? S< Sep20 0:00 [md]root 23 0.0 0.0 0 0 ? S< Sep20 0:00 [edac-poller]root 24 0.0 0.0 0 0 ? S< Sep20 0:00 [watchdogd]root 30 0.0 0.0 0 0 ? S Sep20 0:01 [kswapd0]root 31 0.0 0.0 0 0 ? SN Sep20 0:00 [ksmd]root 32 0.0 0.0 0 0 ? SN Sep20 0:08 [khugepaged]root 33 0.0 0.0 0 0 ? S< Sep20 0:00 [crypto]root 41 0.0 0.0 0 0 ? S< Sep20 0:00 [kthrotld]root 43 0.0 0.0 0 0 ? S< Sep20 0:00 [kmpath_rdacd]root 44 0.0 0.0 0 0 ? S< Sep20 0:00 [kaluad]root 45 0.0 0.0 0 0 ? S< Sep20 0:00 [kpsmoused]root 46 0.0 0.0 0 0 ? S< Sep20 0:00 [ipv6_addrconf]root 59 0.0 0.0 0 0 ? S< Sep20 0:00 [deferwq]root 90 0.0 0.0 0 0 ? S Sep20 0:00 [kauditd]root 244 0.0 0.0 0 0 ? S< Sep20 0:00 [ata_sff]root 260 0.0 0.0 0 0 ? S Sep20 0:00 [scsi_eh_0]root 261 0.0 0.0 0 0 ? S< Sep20 0:00 [scsi_tmf_0]root 262 0.0 0.0 0 0 ? S Sep20 0:00 [scsi_eh_1]root 263 0.0 0.0 0 0 ? S< Sep20 0:00 [scsi_tmf_1]root 266 0.0 0.0 0 0 ? S< Sep20 0:00 [ttm_swap]root 274 0.0 0.0 0 0 ? S< Sep20 0:16 [kworker/0:1H]root 283 0.0 0.0 0 0 ? S Sep20 0:30 [jbd2/vda1-8]root 284 0.0 0.0 0 0 ? S< Sep20 0:00 [ext4-rsv-conver]root 485 0.0 0.0 0 0 ? S< Sep20 0:00 [nfit]root 2858 0.0 0.0 0 0 ? S Nov01 0:02 [kworker/u2:1]root 6330 0.0 0.0 0 0 ? S Oct31 0:12 [kworker/u2:2]root 10504 0.0 0.0 0 0 ? R 14:28 0:00 [kworker/0:1]root 29972 0.0 0.0 0 0 ? S Nov20 0:00 [kworker/0:2]root 531 0.0 0.0 110104 860 tty1 Ss+ Sep20 0:00 /sbin/agetty --noclear tty1 linuxroot 530 0.0 0.0 110104 876 ttyS0 Ss+ Sep20 0:00 /sbin/agetty --keep-baud 115200,38400,9600 ttyS0 vt220root 525 0.0 0.0 25904 956 ? Ss Sep20 0:00 /usr/sbin/atd -froot 490 0.0 0.0 55520 1104 ? S<sl Sep20 0:05 /sbin/auditdroot 12552 0.0 0.0 127768 1412 ? Ss Nov05 0:00 SCREEN -S jupyerhubroot 12341 0.0 0.0 127900 1496 ? Ss Nov05 0:00 SCREEN -A jupyterhubroot 14271 0.0 0.0 99980 1600 ? Sl Oct31 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 2021 -container-ip 172.17.0.2 -container-portroot 14251 0.0 0.0 99980 1604 ? Sl Oct31 0:01 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8888 -container-ip 172.17.0.2 -container-portroot 14261 0.0 0.0 99980 1604 ? Sl Oct31 0:01 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 2031 -container-ip 172.17.0.2 -container-portroot 527 0.0 0.0 126288 1624 ? Ss Sep20 0:09 /usr/sbin/crond -nroot 14290 0.0 0.0 18364 1644 pts/2 Ss+ Oct31 0:00 /bin/bash /etc/gaga.shroot 519 0.0 0.0 26376 1744 ? Ss Sep20 0:15 /usr/lib/systemd/systemd-logindroot 874 0.0 0.0 115436 1768 ? S Sep20 0:00 /bin/sh /application/mysql-5.6.42/bin/MysqLd_safe --datadir=/application/mysql-5.6.42/data --pID-file=/appchrony 537 0.0 0.0 117784 1876 ? S Sep20 0:15 /usr/sbin/chronydroot 14275 0.0 0.1 264004 1900 ? Sl Oct31 0:01 docker-containerd-shim b06a869d21137a3dddbb60335a8adc23aaa1066c718ffc3439e65ade04e1e766 /var/run/docker/liroot 608 0.0 0.1 155496 1924 pts/0 R+ 22:04 0:00 ps aux --sort=%memroot 752 0.0 0.1 107464 2156 ? Ss Sep20 0:00 /sbin/dhclIEnt -1 -q -lf /var/lib/dhclIEnt/dhclIEnt--eth0.lease -pf /var/run/dhclIEnt-eth0.pID -H qiuPing root 374 0.0 0.1 45012 2196 ? Ss Sep20 0:00 /usr/lib/systemd/systemd-udevdroot 905 0.0 0.1 125116 2272 ? Ss Nov02 0:00 Nginx: master process /usr/sbin/Nginxdbus 513 0.0 0.1 58220 2292 ? Ss Sep20 0:28 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopIDfile --systemd-activation33 14402 0.0 0.1 33428 2432 pts/2 S Oct31 0:03 Nginx: worker processroot 12553 0.0 0.1 116388 3004 pts/4 Ss+ Nov05 0:00 /bin/bashroot 14395 0.0 0.1 32720 3184 pts/2 S Oct31 0:00 Nginx: master process /usr/sbin/Nginx -g daemon off;root 820 0.0 0.1 41072 3220 ? Ssl Sep20 37:17 /usr/sbin/aliyun-serviceroot 548 0.1 0.1 116628 3244 pts/0 Ss 22:04 0:00 -bashjupyter 12639 0.0 0.1 116840 3404 pts/5 Ss+ Nov05 0:00 /bin/bash -lroot 14397 0.0 0.1 237312 3468 pts/2 Sl Oct31 0:01 /usr/bin/duckchat-gateway-ubuntu -httpBackend=http://127.0.0.1/ 1>/dev/nullroot 1 0.0 0.1 125460 3584 ? Ss Sep20 11:12 /usr/lib/systemd/systemd --switched-root --system --deserialize 22Nginx 906 0.0 0.2 125888 4052 ? S Nov02 0:03 Nginx: worker processroot 12512 0.0 0.2 32528 4228 ? S<sl Nov19 1:35 /usr/local/aegis/aegis_update/AliYunDunUpdateroot 1125 0.0 0.2 112864 4340 ? Ss Sep20 0:00 /usr/sbin/sshd -Droot 534 0.1 0.3 157388 5984 ? Ss 22:04 0:00 sshd: root@pts/0root 821 0.0 0.3 362012 6508 ? Ssl Sep20 3:44 /usr/sbin/rsyslogd -nroot 1113 0.0 0.4 242200 9324 ? Ssl Sep20 46:15 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --st65534 28829 0.0 0.5 439336 9536 pts/2 S Nov21 0:00 PHP-fpm: pool wwwroot 351 0.0 0.5 47328 9628 ? Ss Sep20 0:15 /usr/lib/systemd/systemd-journald65534 1944 0.0 0.5 439532 10600 pts/2 S Nov19 0:00 PHP-fpm: pool www65534 18283 0.0 0.5 439532 10604 pts/2 S Nov19 0:00 PHP-fpm: pool www65534 30518 0.0 0.5 439532 10612 pts/2 S Nov17 0:00 PHP-fpm: pool wwwpolkitd 521 0.0 0.6 716592 11452 ? Ssl Sep20 0:11 /usr/lib/polkit-1/polkitd --no-deBUG65534 4633 0.0 0.6 439532 12620 pts/2 S Nov19 0:00 PHP-fpm: pool www65534 13194 0.0 0.6 439676 12644 pts/2 S Nov18 0:00 PHP-fpm: pool www65534 8699 0.0 0.6 439704 13088 pts/2 S Nov16 0:00 PHP-fpm: pool wwwroot 815 0.0 0.7 573920 14744 ? Ssl Sep20 9:33 /usr/bin/python2 -Es /usr/sbin/tuned -l -Proot 12586 1.5 0.8 132912 15116 ? S<sl Nov19 78:05 /usr/local/aegis/aegis_clIEnt/aegis_10_75/AliYunDunroot 14396 0.0 0.9 438808 16952 pts/2 S Oct31 1:29 PHP-fpm: master process (/etc/PHP/7.2/fpm/PHP-fpm.conf)root 14391 0.0 0.9 54812 16956 pts/2 S+ Oct31 6:54 /usr/bin/python /usr/bin/supervisord --nodaemon --configuration /etc/supervisor/supervisord.confroot 1460 0.0 1.2 613004 24204 ? Ssl Sep20 0:27 PM2 v3.5.1: God Daemon (/root/.pm2)root 818 0.0 1.5 737300 29832 ? Ssl Sep20 68:25 /usr/bin/dockerdroot 12348 0.0 1.7 571116 32760 ? Ssl Nov05 0:06 node /root/download/node/bin/configurable-http-proxy --ip --port 8000 --API-ip 127.0.0.1 --API-port 8001 root 819 0.3 1.8 993740 34320 ? Ssl Sep20 339:30 /usr/bin/taosdroot 23187 0.0 1.8 256672 35464 ? S Oct22 5:39 python app.py runserver -h 0.0.0.0root 12342 0.0 2.7 766296 52152 pts/3 Ssl+ Nov05 3:39 /usr/local/bin/python3.6 /usr/local/bin/jupyterhubjupyter 12617 0.0 3.3 719872 63920 ? Ssl Nov05 0:14 /usr/local/bin/python3.6 /usr/local/bin/jupyterhub-singleuser --port=53971MysqL 18832 0.0 6.3 995620 119772 ? Sl Nov20 1:21 /application/mysql-5.6.42/bin/MysqLd --basedir=/application/mysql-5.6.42 --datadir=/application/mysql-5.6.101 14398 0.0 9.0 1153192 170700 pts/2 Sl Oct31 18:43 /usr/sbin/MysqLd --user=rootroot 1066 0.1 14.7 2569628 277748 ? Sl Nov02 37:15 /usr/java/latest/bin/java -Djava.util.logging.config.file=/usr/local/tomcat//conf/logging.propertIEs -Djav[root@test ~]#
说明:--sort就是指定以某一字段排序
方法二
[root@test ~]#ps aux |awk '{if(NR != 1){print ,说明:以上方法利用awk把第四行字段取出来,然后在显示整行,然后对组合的条目排序。2、编写脚本,使用for和while分别实现192.168.0.0/24网段内,地址是否能够Ping通,若Ping通则输出"success!",若Ping不通则输出"fail!" 1)for循环实现[root@test ~]#cat Ping.sh #!/bin/bashdecare -i ipbegin=1decare -i ipend=254network="192.168.0."for ip in `seq $ipbegin $ipend`;do { Ping -c 1 -w 1 ${network}$ip &>/dev/null if [ $? -eq 0 ];then echo -e "3[032m${network}$ip is success! 3[0m" else echo -e "3[031m${network}$ip is fail! 3[0m" fi}&donewait[root@test ~]#}}'|sort -n0.0 chrony 537 0.0 0.0 117784 1876 ? S Sep20 0:15 /usr/sbin/chronyd0.0 root 10 0.0 0.0 0 0 ? S< Sep20 0:00 [lru-add-drain]0.0 root 10504 0.0 0.0 0 0 ? S 14:28 0:00 [kworker/0:1]0.0 root 1081 0.0 0.0 113544 976 pts/0 S+ 22:13 0:00 awk {if(NR != 1){print ,[root@test ~]#cat Ping.sh #!/bin/bashdeclare -i ipbegin=1declare -i ipend=254network="192.168.0."for((i=$ipbegin;i<=$ipend;i++));do { Ping -c 1 -w 1 ${network}$i &>/dev/null if [ $? -eq 0 ];then echo -e "3[032m${network}$i is success! 3[0m" else echo -e "3[031m${network}$i is fail! 3[0m" fi }&donewait}}0.0 root 1082 0.0 0.0 116500 920 pts/0 S+ 22:13 0:00 sort -n0.0 root 11 0.0 0.0 0 0 ? S Sep20 0:18 [watchdog/0]0.0 root 12341 0.0 0.0 127900 1496 ? Ss Nov05 0:00 SCREEN -A jupyterhub0.0 root 12552 0.0 0.0 127768 1412 ? Ss Nov05 0:00 SCREEN -S jupyerhub0.0 root 13 0.0 0.0 0 0 ? S Sep20 0:00 [kdevtmpfs]0.0 root 14 0.0 0.0 0 0 ? S< Sep20 0:00 [netns]0.0 root 14251 0.0 0.0 99980 1604 ? Sl Oct31 0:01 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8888 -container-ip 172.17.0.2 -container-port 800.0 root 14261 0.0 0.0 99980 1604 ? Sl Oct31 0:01 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 2031 -container-ip 172.17.0.2 -container-port 20310.0 root 14271 0.0 0.0 99980 1600 ? Sl Oct31 0:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 2021 -container-ip 172.17.0.2 -container-port 20210.0 root 14290 0.0 0.0 18364 1644 pts/2 Ss+ Oct31 0:00 /bin/bash /etc/gaga.sh0.0 root 15 0.0 0.0 0 0 ? S Sep20 0:01 [khungtaskd]0.0 root 16 0.0 0.0 0 0 ? S< Sep20 0:00 [writeback]0.0 root 17 0.0 0.0 0 0 ? S< Sep20 0:00 [kintegrityd]0.0 root 18 0.0 0.0 0 0 ? S< Sep20 0:00 [bioset]0.0 root 19 0.0 0.0 0 0 ? S< Sep20 0:00 [bioset]0.0 root 20 0.0 0.0 0 0 ? S< Sep20 0:00 [bioset]0.0 root 2 0.0 0.0 0 0 ? S Sep20 0:00 [kthreadd]0.0 root 21 0.0 0.0 0 0 ? S< Sep20 0:00 [kblockd]0.0 root 22 0.0 0.0 0 0 ? S< Sep20 0:00 [md]0.0 root 23 0.0 0.0 0 0 ? S< Sep20 0:00 [edac-poller]0.0 root 24 0.0 0.0 0 0 ? S< Sep20 0:00 [watchdogd]0.0 root 244 0.0 0.0 0 0 ? S< Sep20 0:00 [ata_sff]0.0 root 260 0.0 0.0 0 0 ? S Sep20 0:00 [scsi_eh_0]0.0 root 261 0.0 0.0 0 0 ? S< Sep20 0:00 [scsi_tmf_0]0.0 root 262 0.0 0.0 0 0 ? S Sep20 0:00 [scsi_eh_1]0.0 root 263 0.0 0.0 0 0 ? S< Sep20 0:00 [scsi_tmf_1]0.0 root 266 0.0 0.0 0 0 ? S< Sep20 0:00 [ttm_swap]0.0 root 274 0.0 0.0 0 0 ? S< Sep20 0:16 [kworker/0:1H]0.0 root 283 0.0 0.0 0 0 ? S Sep20 0:30 [jbd2/vda1-8]0.0 root 284 0.0 0.0 0 0 ? S< Sep20 0:00 [ext4-rsv-conver]0.0 root 2858 0.0 0.0 0 0 ? S Nov01 0:02 [kworker/u2:1]0.0 root 29972 0.0 0.0 0 0 ? S Nov20 0:00 [kworker/0:2]0.0 root 30 0.0 0.0 0 0 ? S Sep20 0:01 [kswapd0]0.0 root 3 0.0 0.0 0 0 ? S Sep20 0:18 [ksoftirqd/0]0.0 root 31 0.0 0.0 0 0 ? SN Sep20 0:00 [ksmd]0.0 root 32 0.0 0.0 0 0 ? SN Sep20 0:08 [khugepaged]0.0 root 33 0.0 0.0 0 0 ? S< Sep20 0:00 [crypto]0.0 root 41 0.0 0.0 0 0 ? S< Sep20 0:00 [kthrotld]0.0 root 43 0.0 0.0 0 0 ? S< Sep20 0:00 [kmpath_rdacd]0.0 root 44 0.0 0.0 0 0 ? S< Sep20 0:00 [kaluad]0.0 root 45 0.0 0.0 0 0 ? S< Sep20 0:00 [kpsmoused]0.0 root 46 0.0 0.0 0 0 ? S< Sep20 0:00 [ipv6_addrconf]0.0 root 485 0.0 0.0 0 0 ? S< Sep20 0:00 [nfit]0.0 root 490 0.0 0.0 55520 1104 ? S<sl Sep20 0:05 /sbin/auditd0.0 root 5 0.0 0.0 0 0 ? S< Sep20 0:00 [kworker/0:0H]0.0 root 519 0.0 0.0 26376 1744 ? Ss Sep20 0:15 /usr/lib/systemd/systemd-logind0.0 root 525 0.0 0.0 25904 956 ? Ss Sep20 0:00 /usr/sbin/atd -f0.0 root 527 0.0 0.0 126288 1624 ? Ss Sep20 0:09 /usr/sbin/crond -n0.0 root 530 0.0 0.0 110104 876 ttyS0 Ss+ Sep20 0:00 /sbin/agetty --keep-baud 115200,9600 ttyS0 vt2200.0 root 531 0.0 0.0 110104 860 tty1 Ss+ Sep20 0:00 /sbin/agetty --noclear tty1 linux0.0 root 59 0.0 0.0 0 0 ? S< Sep20 0:00 [deferwq]0.0 root 6330 0.0 0.0 0 0 ? S Oct31 0:12 [kworker/u2:2]0.0 root 7 0.0 0.0 0 0 ? S Sep20 0:00 [migration/0]0.0 root 8 0.0 0.0 0 0 ? S Sep20 0:00 [rcu_bh]0.0 root 874 0.0 0.0 115436 1768 ? S Sep20 0:00 /bin/sh /application/mysql-5.6.42/bin/MysqLd_safe --datadir=/application/mysql-5.6.42/data --pID-file=/application/mysql-5.6.42/data/qiuPing.pID0.0 root 90 0.0 0.0 0 0 ? S Sep20 0:00 [kauditd]0.0 root 9 0.0 0.0 0 0 ? R Sep20 7:21 [rcu_sched]0.1 33 14402 0.0 0.1 33428 2432 pts/2 S Oct31 0:03 Nginx: worker process0.1 dbus 513 0.0 0.1 58220 2292 ? Ss Sep20 0:28 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopIDfile --systemd-activation0.1 jupyter 12639 0.0 0.1 116840 3404 pts/5 Ss+ Nov05 0:00 /bin/bash -l0.1 root 1 0.0 0.1 125460 3584 ? Ss Sep20 11:12 /usr/lib/systemd/systemd --switched-root --system --deserialize 220.1 root 1080 0.0 0.1 155360 1892 pts/0 R+ 22:13 0:00 ps aux0.1 root 12553 0.0 0.1 116388 3004 pts/4 Ss+ Nov05 0:00 /bin/bash0.1 root 14275 0.0 0.1 264004 1900 ? Sl Oct31 0:01 docker-containerd-shim b06a869d21137a3dddbb60335a8adc23aaa1066c718ffc3439e65ade04e1e766 /var/run/docker/libcontainerd/b06a869d21137a3dddbb60335a8adc23aaa1066c718ffc3439e65ade04e1e766 docker-runc0.1 root 14395 0.0 0.1 32720 3184 pts/2 S Oct31 0:00 Nginx: master process /usr/sbin/Nginx -g daemon off;0.1 root 14397 0.0 0.1 237312 3468 pts/2 Sl Oct31 0:01 /usr/bin/duckchat-gateway-ubuntu -httpBackend=http://127.0.0.1/ 1>/dev/null0.1 root 374 0.0 0.1 45012 2196 ? Ss Sep20 0:00 /usr/lib/systemd/systemd-udevd0.1 root 548 0.0 0.1 116628 3252 pts/0 Ss 22:04 0:00 -bash0.1 root 752 0.0 0.1 107464 2156 ? Ss Sep20 0:00 /sbin/dhclIEnt -1 -q -lf /var/lib/dhclIEnt/dhclIEnt--eth0.lease -pf /var/run/dhclIEnt-eth0.pID -H qiuPing eth00.1 root 820 0.0 0.1 41072 3220 ? Ssl Sep20 37:17 /usr/sbin/aliyun-service0.1 root 905 0.0 0.1 125116 2272 ? Ss Nov02 0:00 Nginx: master process /usr/sbin/Nginx0.2 Nginx 906 0.0 0.2 125888 4052 ? S Nov02 0:03 Nginx: worker process0.2 root 1125 0.0 0.2 112864 4340 ? Ss Sep20 0:00 /usr/sbin/sshd -D0.2 root 12512 0.0 0.2 32528 4228 ? S<sl Nov19 1:35 /usr/local/aegis/aegis_update/AliYunDunUpdate0.3 root 534 0.0 0.3 157388 5984 ? Ss 22:04 0:00 sshd: root@pts/00.3 root 821 0.0 0.3 362012 6508 ? Ssl Sep20 3:44 /usr/sbin/rsyslogd -n0.4 root 1113 0.0 0.4 242200 9324 ? Ssl Sep20 46:15 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc0.5 65534 18283 0.0 0.5 439532 10604 pts/2 S Nov19 0:00 PHP-fpm: pool www0.5 65534 1944 0.0 0.5 439532 10600 pts/2 S Nov19 0:00 PHP-fpm: pool www0.5 65534 28829 0.0 0.5 439336 9536 pts/2 S Nov21 0:00 PHP-fpm: pool www0.5 65534 30518 0.0 0.5 439532 10612 pts/2 S Nov17 0:00 PHP-fpm: pool www0.5 root 351 0.0 0.5 47328 9632 ? Ss Sep20 0:15 /usr/lib/systemd/systemd-journald0.6 65534 13194 0.0 0.6 439676 12644 pts/2 S Nov18 0:00 PHP-fpm: pool www0.6 65534 4633 0.0 0.6 439532 12620 pts/2 S Nov19 0:00 PHP-fpm: pool www0.6 65534 8699 0.0 0.6 439704 13088 pts/2 S Nov16 0:00 PHP-fpm: pool www0.6 polkitd 521 0.0 0.6 716592 11452 ? Ssl Sep20 0:11 /usr/lib/polkit-1/polkitd --no-deBUG0.7 root 815 0.0 0.7 573920 14744 ? Ssl Sep20 9:33 /usr/bin/python2 -Es /usr/sbin/tuned -l -P0.8 root 12586 1.5 0.8 132912 15116 ? S<sl Nov19 78:13 /usr/local/aegis/aegis_clIEnt/aegis_10_75/AliYunDun0.9 root 14391 0.0 0.9 54812 16956 pts/2 S+ Oct31 6:54 /usr/bin/python /usr/bin/supervisord --nodaemon --configuration /etc/supervisor/supervisord.conf0.9 root 14396 0.0 0.9 438808 16952 pts/2 S Oct31 1:29 PHP-fpm: master process (/etc/PHP/7.2/fpm/PHP-fpm.conf)1.2 root 1460 0.0 1.2 613004 24204 ? Ssl Sep20 0:27 PM2 v3.5.1: God Daemon (/root/.pm2)1.5 root 818 0.0 1.5 737300 29832 ? Ssl Sep20 68:25 /usr/bin/dockerd1.7 root 12348 0.0 1.7 571116 32760 ? Ssl Nov05 0:06 node /root/download/node/bin/configurable-http-proxy --ip --port 8000 --API-ip 127.0.0.1 --API-port 8001 --error-target http://127.0.0.1:8081/hub/error1.8 root 23187 0.0 1.8 256672 35464 ? S Oct22 5:39 python app.py runserver -h 0.0.0.01.8 root 819 0.3 1.8 993740 34320 ? Ssl Sep20 339:32 /usr/bin/taosd2.7 root 12342 0.0 2.7 766296 52152 pts/3 Ssl+ Nov05 3:39 /usr/local/bin/python3.6 /usr/local/bin/jupyterhub3.3 jupyter 12617 0.0 3.3 719872 63920 ? Ssl Nov05 0:14 /usr/local/bin/python3.6 /usr/local/bin/jupyterhub-singleuser --port=539716.3 MysqL 18832 0.0 6.3 995620 119772 ? Sl Nov20 1:22 /application/mysql-5.6.42/bin/MysqLd --basedir=/application/mysql-5.6.42 --datadir=/application/mysql-5.6.42/data --plugin-dir=/application/mysql-5.6.42/lib/plugin --user=MysqL --log-error=qiuPing.err --pID-file=/application/mysql-5.6.42/data/qiuPing.pID --socket=/application/mysql-5.6.42/tmp/MysqL.sock --port=33069.0 101 14398 0.0 9.0 1153192 170700 pts/2 Sl Oct31 18:43 /usr/sbin/MysqLd --user=root14.7 root 1066 0.1 14.7 2569628 277748 ? Sl Nov02 37:16 /usr/java/latest/bin/java -Djava.util.logging.config.file=/usr/local/tomcat//conf/logging.propertIEs -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat//endorsed -classpath /usr/local/tomcat//bin/bootstrap.jar:/usr/local/tomcat//bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat/ -Dcatalina.home=/usr/local/tomcat/ -Djava.io.tmpdir=/usr/local/tomcat//temp org.apache.catalina.startup.bootstrap start[root@test ~]#
[root@test ~]#cat Ping.sh #!/bin/bashdeclare -i ipbegin=1declare -i ipend=254network="192.168.0."while [ $ipbegin -le $ipend ];do { Ping -c 1 -w 1 ${network}${ipbegin} &>/dev/null if [ $? -eq 0 ];then echo -e "3[032m${network}${ipbegin} is success! 3[0m" else echo -e "3[031m${network}${ipbegin} is fail! 3[0m" fi }& let ipbegin+=1donewait2)c语言风格for循环实现
[root@test ~]#cat backup.sh #!/bin/bashbackup_file="/etc"backup_dest="/backup"[ ! -e $backup_dest ] && mkdir $backup_dest|| ture[ $? -eq 0 ] && tar zcf ${backup_dest}/etcbak-`date -d 'yesterday' '+%F-%H-%M-%s'`.tar.xz $backup_file &>/dev/null[root@test ~]#3)while循环实现
[root@test ~]#crontab -l30 01 * * 1-5 root /bin/bash /root/backup.sh &> /dev/null[root@test ~]#说明:while循环使用多线程的方式,需要把let ipbegin+=1放在"}&"之后,不能连let ipbegin+=1也括在里面。3、每周的工作日1:30,将/etc备份至/backup目录中,保存的文件名称格式 为“etcbak-yyyy-mm-dd-HH.tar.xz”,其中日期是前一天的时间 1)编写备份脚本
#!/bin/bashfor i in `df|awk '/^\/dev\//{print }'|cut -d '%' -f1`;do if [ $i -gt 80 ];then# /bin/wall "disk is full" echo "disk is full" | mail -s "warning" 467697313@qq.com &> /dev/null fidone[root@test ~]#
2)制定计划任务
[root@test ~]#crontab -l*/10 * * * 1-5 root /bin/bash /root/checkdisk.sh &> /dev/null[root@test ~]#
4、工作日时间,每10分钟执行一次磁盘空间检查,一旦发现任何分区利用率高 于80%,就发送邮件报警
1)编写检查磁盘空间脚本
说明:以上脚本发送邮件需要先配置邮件
2)制定计划任务
总结以上是内存溢出为你收集整理的Linux进程和计划任务实践全部内容,希望文章能够帮你解决Linux进程和计划任务实践所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。欢迎分享,转载请注明来源:内存溢出
评论列表(0条)