mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Set DSVPN values from VPS in one time
This commit is contained in:
		
							parent
							
								
									519e993d11
								
							
						
					
					
						commit
						6f5b9ded1c
					
				
					 1 changed files with 2 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -280,25 +280,18 @@ _get_vps_config() {
 | 
			
		|||
	port="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.port')"
 | 
			
		||||
	localip="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.client_ip')"
 | 
			
		||||
	remoteip="$(echo "$vps_config" | jsonfilter -q -e '@.dsvpn.host_ip')"
 | 
			
		||||
	if [ "$(uci -q get dsvpn.vpn.port)" != "$port" ] || [ "$(uci -q get dsvpn.vpn.localip)" != "$localip" ] || [ "$(uci -q get dsvpn.vpn.remoteip)" != "$remoteip" ]; then
 | 
			
		||||
	if ([ "$(uci -q get dsvpn.vpn.host)" != "127.0.0.1" ] && [ "$(uci -q get dsvpn.vpn.host)" != "$vpsip" ]) || [ "$(uci -q get dsvpn.vpn.port)" != "$port" ] || [ "$(uci -q get dsvpn.vpn.localip)" != "$localip" ] || [ "$(uci -q get dsvpn.vpn.remoteip)" != "$remoteip" ]; then
 | 
			
		||||
		uci -q batch <<-EOF >/dev/null
 | 
			
		||||
			set dsvpn.vpn.port=$port
 | 
			
		||||
			set dsvpn.vpn.localip=$localip
 | 
			
		||||
			set dsvpn.vpn.remoteip=$remoteip
 | 
			
		||||
			commit dsvpn
 | 
			
		||||
		EOF
 | 
			
		||||
		logger -t "OMR-VPS" "Restart DSVPN..."
 | 
			
		||||
		/etc/init.d/dsvpn restart
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if [ "$(uci -q get dsvpn.vpn.host)" != "127.0.0.1" ] && [ "$(uci -q get dsvpn.vpn.host)" != "$vpsip" ]; then
 | 
			
		||||
		uci -q batch <<-EOF >/dev/null
 | 
			
		||||
			set dsvpn.vpn.host="$vpsip"
 | 
			
		||||
			commit dsvpn
 | 
			
		||||
		EOF
 | 
			
		||||
		logger -t "OMR-VPS" "Restart DSVPN..."
 | 
			
		||||
		/etc/init.d/dsvpn restart
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if [ "$(uci -q get mlvpn.general.host)" != "127.0.0.1" ] && [ "$(uci -q get mlvpn.general.host)" != "$vpsip" ] && [ -f /etc/init.d/mlvpn ]; then
 | 
			
		||||
		uci -q batch <<-EOF >/dev/null
 | 
			
		||||
			set mlvpn.general=mlvpn
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue