mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Add speedtest to server
This commit is contained in:
		
							parent
							
								
									0de06e413b
								
							
						
					
					
						commit
						d17db93106
					
				
					 1 changed files with 26 additions and 0 deletions
				
			
		
							
								
								
									
										26
									
								
								openmptcprouter/files/bin/omr-test-speed-server
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										26
									
								
								openmptcprouter/files/bin/omr-test-speed-server
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,26 @@ | |||
| #!/bin/sh | ||||
| SERVER=$1 | ||||
| INTERFACE=$2 | ||||
| [ -z "$SERVER" ] && SERVER="vps" | ||||
| KEY=$(uci -q get openmptcprouter.$SERVER.token) | ||||
| HOST=$(uci -q get openmptcprouter.$SERVER.ip | awk '{print $1}') | ||||
| PORT=$(uci -q get openmptcprouter.$SERVER.port) | ||||
| MP=false | ||||
| if [ -n "$KEY" ] && [ -n "$HOST" ] && [ -n "$PORT" ]; then | ||||
| 	trap : HUP INT TERM | ||||
| 	echo "Download test via server ${SERVER}:" | ||||
| 	if [ -n "$INTERFACE" ]; then | ||||
| 		if [ "$(multipath ${INTERFACE} | grep default)" ]; then | ||||
| 			MP=true | ||||
| 			/etc/init.d/omr-tracker stop 2>&1 >/dev/null | ||||
| 			multipath ${INTERFACE} off | ||||
| 		fi | ||||
| 		curl -k -o /dev/null --interface $INTERFACE -H "Authorization: Bearer ${KEY}" https://${HOST}:${PORT}/speedtest || echo | ||||
| 		if [ $MP ]; then | ||||
| 			multipath ${INTERFACE} on | ||||
| 			/etc/init.d/omr-tracker start & 2>&1 >/dev/null | ||||
| 		fi | ||||
| 	else | ||||
| 		curl -k -o /dev/null -H "Authorization: Bearer ${KEY}" https://${HOST}:${PORT}/speedtest || echo | ||||
| 	fi | ||||
| fi | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue