mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Fix and additionnal check on OpenMPTCProuter VPS script
This commit is contained in:
parent
86edfa855d
commit
21f8a2e759
1 changed files with 33 additions and 19 deletions
|
@ -1627,7 +1627,7 @@ _set_config_from_vps() {
|
|||
config_foreach _set_ss_server server "server" $vpsip
|
||||
fi
|
||||
uci -q commit shadowsocks-libev
|
||||
if [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ]; then
|
||||
if [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && [ -n "$(uci -q changes shadowsocks-libev)" ]; then
|
||||
logger -t "OMR-VPS" "Shadowsocks restart..."
|
||||
/etc/init.d/shadowsocks-libev restart >/dev/null 2>&1
|
||||
fi
|
||||
|
@ -1655,7 +1655,7 @@ _set_config_from_vps() {
|
|||
config_foreach _set_ssrust_server server "server" $vpsip
|
||||
fi
|
||||
uci -q commit shadowsocks-rust
|
||||
if [ "$(uci -q get shadowsocks-rust.sss0.disabled)" != "1" ]; then
|
||||
if [ "$(uci -q get shadowsocks-rust.sss0.disabled)" != "1" ] && [ -n "$(uci -q changes shadowsocks-rust)" ]; then
|
||||
logger -t "OMR-VPS" "Shadowsocks Rust restart..."
|
||||
/etc/init.d/shadowsocks-rust restart >/dev/null 2>&1
|
||||
fi
|
||||
|
@ -1683,7 +1683,7 @@ _set_config_from_vps() {
|
|||
uci -q set v2ray.omrout.s_socks_address="$vpsip"
|
||||
fi
|
||||
uci -q commit v2ray
|
||||
if [ "$(uci -q get v2ray.main.enabled)" = "1" ]; then
|
||||
if [ "$(uci -q get v2ray.main.enabled)" = "1" ] && [ -n "$(uci -q changes v2ray)" ]; then
|
||||
logger -t "OMR-VPS" "V2ray restart..."
|
||||
/etc/init.d/v2ray restart >/dev/null 2>&1
|
||||
fi
|
||||
|
@ -1720,7 +1720,7 @@ _set_config_from_vps() {
|
|||
uci -q set xray.omrout.s_shadowsocks_address="$vpsip"
|
||||
fi
|
||||
uci -q commit xray
|
||||
if [ "$(uci -q get xray.main.enabled)" = "1" ]; then
|
||||
if [ "$(uci -q get xray.main.enabled)" = "1" ] && [ -n "$(uci -q changes xray)" ]; then
|
||||
logger -t "OMR-VPS" "Xray restart..."
|
||||
/etc/init.d/xray restart >/dev/null 2>&1
|
||||
fi
|
||||
|
@ -1749,8 +1749,10 @@ _set_config_from_vps() {
|
|||
uci -q set glorytun.vpn.host="$vpsip"
|
||||
fi
|
||||
uci -q commit glorytun
|
||||
logger -t "OMR-VPS" "Glorytun restart..."
|
||||
/etc/init.d/glorytun restart >/dev/null 2>&1
|
||||
if [ -n "$(uci -q changes glorytun)" ]; then
|
||||
logger -t "OMR-VPS" "Glorytun restart..."
|
||||
/etc/init.d/glorytun restart >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
if [ -n "$(uci -q get glorytun.udp)" ] && (([ -n "$glorytun_key" ] && [ "$glorytun_key" != "$(uci -q get glorytun-udp.vpn.key)" ]) || ([ -n "$glorytun_port" ] || [ "$glorytun_port" != "$(uci -q get glorytun-udp.vpn.port)" ])); then
|
||||
vpn="$(uci -q get openmptcprouter.settings.vpn)"
|
||||
|
@ -1772,8 +1774,10 @@ _set_config_from_vps() {
|
|||
uci -q set glorytun-udp.vpn.host="$vpsip"
|
||||
fi
|
||||
uci -q commit glorytun-udp
|
||||
logger -t "OMR-VPS" "Glorytun UDP restart..."
|
||||
/etc/init.d/glorytun-udp restart >/dev/null 2>&1
|
||||
if [ -n "$(uci -q changes glorytun-udp)" ]; then
|
||||
logger -t "OMR-VPS" "Glorytun UDP restart..."
|
||||
/etc/init.d/glorytun-udp restart >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
# OpenVPN settings
|
||||
|
@ -1800,8 +1804,10 @@ _set_config_from_vps() {
|
|||
uci -q set openvpn.omr.remote="$vpsip"
|
||||
fi
|
||||
uci -q commit openvpn
|
||||
logger -t "OMR-VPS" "OpenVPN restart..."
|
||||
/etc/init.d/openvpn restart
|
||||
if [ -n "$(uci -q changes openvpn)" ]; then
|
||||
logger -t "OMR-VPS" "OpenVPN restart..."
|
||||
/etc/init.d/openvpn restart
|
||||
fi
|
||||
}
|
||||
openvpn_client_key="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.client_key')"
|
||||
[ -n "$openvpn_client_key" ] && {
|
||||
|
@ -1837,8 +1843,10 @@ _set_config_from_vps() {
|
|||
uci -q add_list openvpn.omr.remote="$vpsip"
|
||||
fi
|
||||
uci -q commit openvpn
|
||||
logger -t "OMR-VPS" "OpenVPN restart..."
|
||||
/etc/init.d/openvpn restart
|
||||
if [ -n "$(uci -q changes openvpn)" ]; then
|
||||
logger -t "OMR-VPS" "OpenVPN restart..."
|
||||
/etc/init.d/openvpn restart
|
||||
fi
|
||||
}
|
||||
|
||||
# MLVPN settings
|
||||
|
@ -1858,8 +1866,10 @@ _set_config_from_vps() {
|
|||
uci -q set mlvpn.general.host="$vpsip"
|
||||
fi
|
||||
uci -q commit mlvpn
|
||||
logger -t "OMR-VPS" "MLVPN restart..."
|
||||
/etc/init.d/mlvpn restart
|
||||
if [ -n "$(uci -q changes mlvpn)" ]; then
|
||||
logger -t "OMR-VPS" "MLVPN restart..."
|
||||
/etc/init.d/mlvpn restart
|
||||
fi
|
||||
fi
|
||||
|
||||
# DSVPN settings
|
||||
|
@ -1880,8 +1890,10 @@ _set_config_from_vps() {
|
|||
uci -q set dsvpn.vpn.host="$vpsip"
|
||||
fi
|
||||
uci -q commit dsvpn
|
||||
logger -t "OMR-VPS" "DSVPN restart..."
|
||||
/etc/init.d/dsvpn restart
|
||||
if [ -n "$(uci -q changes dsvpn)" ]; then
|
||||
logger -t "OMR-VPS" "DSVPN restart..."
|
||||
/etc/init.d/dsvpn restart
|
||||
fi
|
||||
fi
|
||||
|
||||
# Shorewall settings
|
||||
|
@ -1950,8 +1962,10 @@ _set_config_from_vps() {
|
|||
set network.omr6in4.gateway="$omr6in4_vps_localip"
|
||||
commit network
|
||||
EOF
|
||||
/etc/init.d/network reload
|
||||
sleep 6
|
||||
if [ -n "$(uci -q changes network)" ]; then
|
||||
/etc/init.d/network reload
|
||||
sleep 6
|
||||
fi
|
||||
fi
|
||||
|
||||
# Get VPS iperf config
|
||||
|
@ -2295,7 +2309,7 @@ _config_service() {
|
|||
[ -z "$(_set_vpn_vps)" ] && error=1
|
||||
[ -z "$(_set_proxy_vps)" ] && error=1
|
||||
fi
|
||||
([ -n "$(uci -q get shadowsocks-libev.sss0)" ] || [ -n "$(uci -q get shadowsocks-rust.sss0)" ]) && [ "$(uci -q get shadowsocks-libev.sss0.key)" = "" ] && [ "$(uci -q get shadowsocks-rust.sss0.key)" = "" ] && uci -q set openmptcprouter.${servername}.get_config=1
|
||||
([ -n "$(uci -q get shadowsocks-libev.sss0)" ] || [ -n "$(uci -q get shadowsocks-rust.sss0)" ]) && [ "$(uci -q get shadowsocks-libev.sss0.key)" = "" ] && [ "$(uci -q get shadowsocks-rust.sss0.password)" = "" ] && uci -q set openmptcprouter.${servername}.get_config=1
|
||||
|
||||
#_set_pihole
|
||||
[ -n "$wanips" ] && _set_wan_ip
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue