最終同事協助解決問題是用這個貼子:https://blog.csdn.net/weixin_32487557/article/details/116631040
使用 CentOS 7.3 系統進,使用 top 命令發現 -bash 或 systemd 進程占 cpu 的百分比高,持續不下。
1、使用命令查看是否有定時任務。
crontab -e
這個是關鍵。找到定時任務后,如果定時任務是不正常的,刪除它。
在刪除之前,查看一下文件內容是什么。
我查看的此文件內容是這樣的:
* * * * * /tmp/.X11-unix/.systemd/-bash > /dev/null 2>&1;
進入 /tmp/.X11-unix/.systemd 目錄后,打開文件 -bash(要先把此文件改名,才能打得開),內容是:
1 #!/bin/bash 2 cd -- /tmp/.X11-unix/.systemd 3 mkdir -- .-bash 4 cp -f -- x86_64 .-bash/-bash 5 ./.-bash/-bash -c 6 rm -rf -- .-bash
將此目錄下的所有文件刪除,並在 top 命令下殺掉進程,問題解決。
2、禁用定時任務服務。
systemctl stop crontab;
systemctl disable crontab;
參考: