offline-check.sh
· 265 B · Bash
Raw
#!/bin/bash
# offline-check [ip number of host]
# e.g `offline-check 2` generates /var/www/html/offline.check.2
ping -w1 -c1 10.8.0.$1 | grep "64 bytes from" 2>&1 >/dev/null && rm -f /var/www/html/offline.check.$1 2>/dev/null || touch /var/www/html/offline.check.$1
| 1 | #!/bin/bash |
| 2 | # offline-check [ip number of host] |
| 3 | # e.g `offline-check 2` generates /var/www/html/offline.check.2 |
| 4 | ping -w1 -c1 10.8.0.$1 | grep "64 bytes from" 2>&1 >/dev/null && rm -f /var/www/html/offline.check.$1 2>/dev/null || touch /var/www/html/offline.check.$1 |
snippets-offline.conf
· 169 B · Text
Raw
# server { include /etc/nginx/snippets/offline.conf; }
error_page 502 503 @offline;
location @offline {
root /var/www/html;
rewrite ^(.*)$ /offline.html break;
}
| 1 | # server { include /etc/nginx/snippets/offline.conf; } |
| 2 | error_page 502 503 @offline; |
| 3 | location @offline { |
| 4 | root /var/www/html; |
| 5 | rewrite ^(.*)$ /offline.html break; |
| 6 | } |
snippets-offlineloc.conf
· 141 B · Text
Raw
# location { include /etc/nginx/snippets/offlineloc.conf; }
if (-f /var/www/html/offline.check.2) {
return 503;
}
| 1 | # location { include /etc/nginx/snippets/offlineloc.conf; } |
| 2 | if (-f /var/www/html/offline.check.2) { |
| 3 | return 503; |
| 4 | } |