Created
September 28, 2018 12:50
-
-
Save jakub-bochenski/60df5359679539cb6bfcdb203cfebb93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -xe | |
cat << "JAVA" > Checker.java && javac Checker.java | |
import java.net.HttpURLConnection; | |
import java.net.URL; | |
public class Checker { | |
public static void main(String[] args) throws Exception { | |
HttpURLConnection conn = | |
(HttpURLConnection) new URL(args[0]) | |
.openConnection(); | |
System.exit( | |
200 == conn.getResponseCode() | |
? 0 | |
: 1 | |
); | |
} | |
} | |
JAVA | |
java Checker http://google.pl && echo OK || echo BAD |
Author
jakub-bochenski
commented
Oct 2, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment