init
This commit is contained in:
		
							parent
							
								
									d7a8847877
								
							
						
					
					
						commit
						61ea44de80
					
				
							
								
								
									
										0
									
								
								etc/services
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								etc/services
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										6
									
								
								install.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										6
									
								
								install.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | #!/bin/sh | ||||||
|  | 
 | ||||||
|  | install -D ./libexec/status /usr/local/libexec/yonderly.org/status | ||||||
|  | install -D ./libexec/services /usr/local/libexec/yonderly.org/services | ||||||
|  | 
 | ||||||
|  | install -D -b -m 644  ./etc/services /etc/yonderly.org/services | ||||||
							
								
								
									
										32
									
								
								libexec/services
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										32
									
								
								libexec/services
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,32 @@ | |||||||
|  | #!/bin/sh | ||||||
|  | # prints static page of HTTP responses of given URLs. | ||||||
|  | # ethan@yonderly.org, 0BSD. | ||||||
|  | 
 | ||||||
|  | URLS_FILE="/etc/yonderly.org/services" # a new-line seperated list of URLs. | ||||||
|  | CSS_HREF="/static/main.css" | ||||||
|  | 
 | ||||||
|  | date=$(date) | ||||||
|  | 
 | ||||||
|  | echo '<!DOCTYPE html> | ||||||
|  | <html lang="en"> | ||||||
|  | 	<head> | ||||||
|  | 		<meta charset="UTF-8"> | ||||||
|  | 		<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||||||
|  | 		<link rel="stylesheet" href="'$CSS_HREF'"> | ||||||
|  | 	</head>' | ||||||
|  | echo '	<body> | ||||||
|  | 		<h2>services</h2> | ||||||
|  | 		<p>the following is the statuses of services provided by <b>yonderly.org</b> as of '$date'. feel free to contact us for more information about an extended outage.</p> | ||||||
|  | 		<p>' | ||||||
|  | 		for service in $(cat $URLS_FILE) | ||||||
|  | 		do | ||||||
|  | 			response=`/usr/local/bin/curl -Z --write-out "%{http_code}\n" --silent --output /dev/null "$service"` | ||||||
|  | 			echo "		<b><a href=\"$service\">" | ||||||
|  | 			printf "$service</a></b>: " | ||||||
|  | 			[[ "$response" == "200" ]] && printf "<span style=\"color:green\">" || printf "<span style=\"color:red\">" | ||||||
|  | 			printf "$response</span><br/>" | ||||||
|  | 		done | ||||||
|  | 		echo ' | ||||||
|  | 		</p> | ||||||
|  | 	</body> | ||||||
|  | </html>' | ||||||
							
								
								
									
										23
									
								
								libexec/status
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										23
									
								
								libexec/status
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,23 @@ | |||||||
|  | #!/bin/sh | ||||||
|  | # prints static page with some system information. | ||||||
|  | # ethan@yonderly.org, 0BSD. | ||||||
|  | 
 | ||||||
|  | CSS_HREF="/static/main.css" | ||||||
|  | 
 | ||||||
|  | echo '<!DOCTYPE html> | ||||||
|  | <html lang="en"> | ||||||
|  | 	<head> | ||||||
|  | 		<meta charset="UTF-8"> | ||||||
|  | 		<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||||||
|  | 		<link rel="stylesheet" href="'$CSS_HREF'"> | ||||||
|  | 	</head>' | ||||||
|  | echo ' | ||||||
|  | 	<body> | ||||||
|  | 		<h2>system status</h2> | ||||||
|  | 		<pre>' | ||||||
|  | 		date | ||||||
|  | 		uptime | ||||||
|  | echo '</pre> | ||||||
|  | 	</body> | ||||||
|  | 
 | ||||||
|  | </html>' | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user