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

Add services check for XRay and Shadowsocks-Rust

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-10-02 21:25:23 +02:00
parent 8746eaf337
commit cd69bc6454

View file

@ -12,6 +12,11 @@ if [ -f /etc/init.d/shadowsocks-libev ] && [ "$(pgrep -f omr-tracker-ss)" = "" ]
/etc/init.d/shadowsocks-libev restart 2>&1 >/dev/null
sleep 5
fi
if [ -f /etc/init.d/shadowsocks-rust ] && [ "$(pgrep -f omr-tracker-ss)" = "" ] && [ "$(pgrep -f sslocal)" = "" ] && [ "$(pgrep -f sslocal)" = "" ] && [ "$(uci -q get shadowsocks-rust.sss0.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-rust.sss0.server)" != "" ] && [ "$(uci -q get shadowsocks-rust.sss0.server)" != "192.18.1.3" ] && [ "$(uci -q get shadowsocks-rust.sss0.key)" != "" ]; then
_log "Can't find Shadowsocks Rust, restart it..."
/etc/init.d/shadowsocks-rust restart 2>&1 >/dev/null
sleep 5
fi
if [ -f /etc/init.d/glorytun ] && [ "$(pgrep glorytun)" = "" ] && [ "$(uci -q get glorytun.vpn.enable)" = "1" ] && [ -f /etc/init.d/glorytun ] && [ "$(uci -q get glorytun.vpn.key)" != "" ]; then
_log "Can't find Glorytun, restart it..."
/etc/init.d/glorytun restart 2>&1 >/dev/null
@ -63,6 +68,11 @@ if [ "$(pgrep -f v2ray)" = "" ] && [ "$(uci -q get v2ray.main.enabled)" = "1" ]
/etc/init.d/v2ray restart 2>&1 >/dev/null
sleep 5
fi
if [ "$(pgrep -f xray)" = "" ] && [ "$(uci -q get xray.main.enabled)" = "1" ] && [ -f /etc/init.d/xray ]; then
_log "Can't find XRay, restart it..."
/etc/init.d/xray restart 2>&1 >/dev/null
sleep 5
fi
if [ "$(pgrep miniupnpd)" = "" ] && [ "$(uci -q get upnpd.config.enabled)" = "1" ] && [ -f /etc/init.d/miniupnpd ]; then
_log "Can't find miniupnpd, restart it..."
/etc/init.d/miniupnpd restart 2>&1 >/dev/null
@ -95,13 +105,17 @@ if [ "$(uci -q get v2ray.main.enabled)" = "1" ] && [ -f /etc/init.d/v2ray ] && [
_log "Can't find omr-tracker-v2ray, restart omr-tracker..."
/etc/init.d/omr-tracker restart 2>&1 >/dev/null
fi
if [ "$(uci -q get xray.main.enabled)" = "1" ] && [ -f /etc/init.d/xray ] && [ "$(pgrep -f omr-tracker-xray)" = "" ] && [ "$(pgrep -f '/etc/init.d/omr-tracker')" = "" ]; then
_log "Can't find omr-tracker-xray, restart omr-tracker..."
/etc/init.d/omr-tracker restart 2>&1 >/dev/null
fi
set_get_config() {
local server=$1
[ -n "$server" ] && uci -q set openmptcprouter.${server}.get_config=1
}
if [ -f /etc/init.d/shadowsocks-libev ] && [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-libev.sss0.key)" = "" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "192.18.1.3" ]; then
if ([ -f /etc/init.d/shadowsocks-libev ] && [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-libev.sss0.key)" = "" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "192.18.1.3" ]) || ([ -f /etc/init.d/shadowsocks-rust ] && [ "$(uci -q get shadowsocks-rust.sss0.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-rust.sss0.key)" = "" ] && [ "$(uci -q get shadowsocks-rust.sss0.server)" != "" ] && [ "$(uci -q get shadowsocks-rust.sss0.server)" != "192.18.1.3" ]); then
config_load openmptcprouter
config_foreach set_get_config server
[ -n "$(uci -q changes openmptcprouter)" ] && uci -q commit openmptcprouter
@ -112,6 +126,11 @@ if [ -f /etc/init.d/shadowsocks-libev ] && [ "$(uci -q get shadowsocks-libev.sss
/etc/init.d/omr-tracker restart 2>&1 >/dev/null
fi
if [ -f /etc/init.d/shadowsocks-rust ] && [ "$(uci -q get shadowsocks-rust.sss0.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-rust.sss0.key)" != "" ] && [ "$(uci -q get shadowsocks-rust.sss0.server)" != "" ] && [ "$(uci -q get shadowsocks-libev.rust.server)" != "192.18.1.3" ] && [ "$(pgrep -f omr-tracker-ss)" = "" ] && [ "$(pgrep -f '/etc/init.d/omr-tracker')" = "" ]; then
_log "Can't find omr-tracker-ss, restart omr-tracker..."
/etc/init.d/omr-tracker restart 2>&1 >/dev/null
fi
if [ "$(uci -q get glorytun.vpn.enable)" = "1" ] && [ "$(uci -q get glorytun.vpn.key)" = "" ]; then
config_load openmptcprouter
config_foreach set_get_config server
@ -124,6 +143,12 @@ if [ "$(uci -q get v2ray.main.enabled)" = "1" ] && [ "$(uci -q get v2ray.omrout.
[ -n "$(uci -q changes openmptcprouter)" ] && uci -q commit openmptcprouter
fi
if [ "$(uci -q get xray.main.enabled)" = "1" ] && [ "$(uci -q get xray.omrout.s_vless_user_id)" = "" ]; then
config_load openmptcprouter
config_foreach set_get_config server
[ -n "$(uci -q changes openmptcprouter)" ] && uci -q commit openmptcprouter
fi
if [ -n "$(logread | tail -n 2 | grep 'Ring expansion failed')" ]; then
_log "Workaround Ring expansion failed problem"
echo 1 > /sys/bus/pci/devices/0000:00:00.0/remove