1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00

More check before restarting Shadowsocks firewall rules in OMR-Tracker ss

This commit is contained in:
Ycarus (Yannick Chabanois) 2024-08-07 14:18:54 +02:00
parent 557d37b0dd
commit 30f5850e77

View file

@ -122,7 +122,7 @@ while true; do
[ -n "$script_alert_up" ] && eval $script_alert_up [ -n "$script_alert_up" ] && eval $script_alert_up
} }
if [ -z "$($IPTABLESSAVE 2>/dev/null | grep :ssr)" ] && [ -z "$(nft list ruleset 2>/dev/null | grep ss_r)" ] && [ -z "$(nft list ruleset 2>/dev/null | grep ssr_r)" ]; then if [ -z "$($IPTABLESSAVE 2>/dev/null | grep :ssr)" ] && [ -z "$(nft list ruleset 2>/dev/null | grep ss_r)" ] && [ -z "$(nft list ruleset 2>/dev/null | grep ssr_r)" ]; then
if [ "$type" = "libev" ] && [ "$(uci -q get shadowsocks-libev.ss_rules.disabled)" != "1" ]; then if [ "$type" = "libev" ] && [ "$(uci -q get shadowsocks-libev.ss_rules.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-libev.${server}.key)" != "" ] && [ "$(uci -q get shadowsocks-libev.${server}.server)" != "" ] && [ "$(uci -q get shadowsocks-libev.${server}.disabled)" != "1" ]; then
_log "Reload Shadowsocks rules" _log "Reload Shadowsocks rules"
/etc/init.d/shadowsocks-libev rules_up 2> /dev/null /etc/init.d/shadowsocks-libev rules_up 2> /dev/null
if ! /etc/init.d/shadowsocks-libev rules_exist ; then if ! /etc/init.d/shadowsocks-libev rules_exist ; then
@ -130,7 +130,7 @@ while true; do
/etc/init.d/shadowsocks-libev restart >/dev/null 2>&1 /etc/init.d/shadowsocks-libev restart >/dev/null 2>&1
fi fi
_get_ip _get_ip
elif [ "$type" = "rust" ] && [ "$(uci -q get shadowsocks-rust.ss_rules.disabled)" != "1" ]; then elif [ "$type" = "rust" ] && [ "$(uci -q get shadowsocks-rust.ss_rules.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-rust.${server}.key)" != "" ] && [ "$(uci -q get shadowsocks-rust.${server}.server)" != "" ] && [ "$(uci -q get shadowsocks-rust.${server}.disabled)" != "1" ]; then
_log "Reload Shadowsocks Rust rules" _log "Reload Shadowsocks Rust rules"
/etc/init.d/shadowsocks-rust rules_up 2> /dev/null /etc/init.d/shadowsocks-rust rules_up 2> /dev/null
if ! /etc/init.d/shadowsocks-rust rules_exist ; then if ! /etc/init.d/shadowsocks-rust rules_exist ; then
@ -187,13 +187,13 @@ while true; do
script_alert_down="$(uci -q get omr-tracker.proxy.script_alert_down)" script_alert_down="$(uci -q get omr-tracker.proxy.script_alert_down)"
[ -n "$script_alert_down" ] && eval $script_alert_down [ -n "$script_alert_down" ] && eval $script_alert_down
if [ "$disabled" != "1" ]; then if [ "$disabled" != "1" ] && [ "$serverip" != "1" ]; then
if [ "$type" = "libev" ] && [ "$(pgrep ss-redir)" = "" ] && [ "$(uci -q get shadowsocks-libev.${server}.key)" != "" ]; then if [ "$type" = "libev" ] && [ "$(pgrep ss-redir)" = "" ] && [ "$(uci -q get shadowsocks-libev.${server}.key)" != "" ]; then
_log "Can't find shadowsocks, restart it..." _log "Can't find shadowsocks, restart it..."
/etc/init.d/shadowsocks-libev restart /etc/init.d/shadowsocks-libev restart
sleep 5 sleep 5
fi fi
if [ "$type" = "rust" ] && [ "$(pgrep sslocal)" = "" ] && [ "$(uci -q get shadowsocks-libev.${server}.key)" != "" ]; then if [ "$type" = "rust" ] && [ "$(pgrep sslocal)" = "" ] && [ "$(uci -q get shadowsocks-rust.${server}.key)" != "" ]; then
_log "Can't find shadowsocks rust, restart it..." _log "Can't find shadowsocks rust, restart it..."
/etc/init.d/shadowsocks-rust restart /etc/init.d/shadowsocks-rust restart
sleep 5 sleep 5