From af9e57999e5a589fd276ca394eaa483999937a57 Mon Sep 17 00:00:00 2001 From: WangTsing-Yan Date: Wed, 12 Jun 2024 10:04:47 +0000 Subject: [PATCH] update sysmonitor-1.3.2/script/check_sshd.sh. Signed-off-by: WangTsing-Yan --- sysmonitor-1.3.2/script/check_sshd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysmonitor-1.3.2/script/check_sshd.sh b/sysmonitor-1.3.2/script/check_sshd.sh index 34899a2..8ac9817 100755 --- a/sysmonitor-1.3.2/script/check_sshd.sh +++ b/sysmonitor-1.3.2/script/check_sshd.sh @@ -30,7 +30,7 @@ do done if [ $SSHD_STATUS -ne 0 ];then - SSHD_PID=$(ps -ef | grep -w "/usr/sbin/sshd" | grep -v grep | awk '{if ($3==1) print $2}') + SSHD_PID=$(systemctl show --property MainPID --value sshd) kill -9 $SSHD_PID 2>/dev/null exit 1 fi -- Gitee