#!/bin/sh
t1=`lastb -1 |head -1 |awk -F " " '{print $4 " " $5 " " $6 " " $7}'`
t2=`date -d "$t1" +%s`
current=`date +%s`
t4=`expr $current - $t2`
nt1=`last -1 |head -1 |awk -F " " '{print $4 " " $5 " " $6 " " $7}'`
nt2=`date -d "$nt1" +%s`
nt4=`expr $current - $nt2`
echo "-----------">>/root/yeman8
echo $t4>>/root/yeman8
echo $nt4>>/root/yeman8
if [[ $nt4 -gt 188 && $t4 -lt 70 ]]
then
/bin/systemctl stop sshd.service
echo "stop">>/root/yeman8
sleep 10s
/bin/systemctl start sshd.service
echo "start">>/root/yeman8
fi
2021-10-15ssd
最新推荐文章于 2024-07-19 00:08:02 发布