[add] check frp service, restart it or push an alert to iphone

This commit is contained in:
gitea 2023-11-26 11:16:06 +08:00
parent d6784fa70c
commit c6cb2cf281
2 changed files with 32 additions and 0 deletions

16
update/restart_frpc.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
rss=$(ps aux | grep frpc.toml | grep -v grep | awk '{print $6}')
if [[ $rss == '' ]]; then
python3 /opt/scripts/alert/bark/msgsend.py --title "FRPC Warning" --body "Seems like FRPC Service has been down, need to check ASAP." --group 'frp' --icon 8
exit 9
fi
rss=$((rss/1024))
if [[ $rss -gt 500 ]]; then
systemctl restart frpc.service
fi

16
update/restart_frps.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
rss=$(ps aux | grep frps.toml | grep -v grep | awk '{print $6}')
if [[ $rss == '' ]]; then
ssh -o ConnectTimeout=60 beelink 'python3 /opt/scripts/alert/bark/msgsend.py --title "FRPS Warning" --body "Seems like FRPS Service has been down, need to check ASAP." --group "frp" --icon 8'
exit 9
fi
rss=$((rss/1024))
if [[ $rss -gt 1000 ]]; then
systemctl restart frps.service
fi