mirror of
				https://github.com/vdsm/virtual-dsm.git
				synced 2025-11-04 08:54:51 +08:00 
			
		
		
		
	Server
This commit is contained in:
		
							parent
							
								
									0909931446
								
							
						
					
					
						commit
						41e4cebf5e
					
				@ -1,10 +1,22 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
set -eu
 | 
					set -eu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HTML="<HTML><BODY><H1><CENTER>Please wait while Virtual DSM is installing...</CENTER></H1></BODY></HTML>"
 | 
					# Close any previous instances
 | 
				
			||||||
 | 
					script_name=${BASH_SOURCE[0]}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for pid in $(pidof -x $script_name); do
 | 
				
			||||||
 | 
					  if [ $pid != $$ ]; then
 | 
				
			||||||
 | 
					    kill -9 $pid 2> /dev/null
 | 
				
			||||||
 | 
					    wait $pid 2> /dev/null
 | 
				
			||||||
 | 
					  fi 
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Serve the page
 | 
				
			||||||
 | 
					HTML="<HTML><BODY><H1><CENTER>$2</CENTER></H1></BODY></HTML>"
 | 
				
			||||||
RESPONSE="HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n$HTML\r\n"
 | 
					RESPONSE="HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n$HTML\r\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
while { echo -en "$RESPONSE"; } | nc -lN "${1:-8080}"; do
 | 
					while { echo -en "$RESPONSE"; } | nc -lN "${1:-8080}"; do
 | 
				
			||||||
  echo "================================================"
 | 
					  echo "================================================"
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user