tunnel/checkmemnginx.sh

11 lines
293 B
Bash
Raw Permalink Normal View History

2024-01-16 14:44:09 +00:00
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
MemTotal=`free -t |grep "Mem:" | awk '{print $2}'`
MemUsed=`free -t |grep "Mem:" | awk '{print $3}'`
MemPercent=$((MemUsed*100/MemTotal))
if [ $MemPercent -gt 80 ]
then
systemctl restart nginx
else
exit 1
fi