1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-vps.git synced 2025-03-09 15:50:00 +00:00
openmptcprouter-vps/omr-service
Ycarus (Yannick Chabanois) 42c7489c23 Set VPN IP only when possible
2020-04-07 16:06:54 +02:00

45 lines
908 B
Bash
Executable file

#!/bin/bash
# OpenMPTCProuter VPS service script
_multipath() {
# Force multipath status
source /etc/shorewall/params.net
for intf in `ls -1 /sys/class/net`; do
if [ "$intf" = "$NET_IFACE" ]; then
multipath $intf on
else
multipath $intf off
fi
done
}
_glorytun_udp() {
[ -z "$(glorytun show dev gt-udp-tun0 2>/dev/null | grep server)" ] && {
logger -t "OMR-Service" "Restart Glorytun-UDP"
systemctl -q restart glorytun-udp@*
}
for intf in /etc/glorytun-udp/*; do
/etc/glorytun-udp/post.sh /etc/glorytun-udp/${intf}
done
}
_glorytun_tcp() {
for intf in /etc/glorytun-tcp/*; do
/etc/glorytun-tcp/post.sh /etc/glorytun-tcp/${intf}
done
}
_omr_api() {
[ -z "$(curl -s -k -m 1 https://127.0.0.1:65500/)" ] && {
logger -t "OMR-Service" "Restart OMR-Admin"
systemctl -q restart omr-admin
}
}
while true; do
_glorytun_udp
_glorytun_tcp
_multipath
_omr_api
sleep 10
done