Last active
January 12, 2016 18:26
-
-
Save threewordphrase/89d8c16cc67598781f46 to your computer and use it in GitHub Desktop.
Simple "Oh shit" uptime checker for when nothing else is set up yet, displays OSX notification when URL returns a non-200 code.
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
cd ~/Library/LaunchAgents/ | |
# plist goes in this directory | |
launchctl load com.aaron.whatever.plist | |
# Disable: | |
launchctl unload com.aaron.whatever.plist |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.aaron.urgent</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/Users/aaron/scripts/urgent.sh</string> | |
</array> | |
<key>StartInterval</key> | |
<integer>15</integer> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>StandardErrorPath</key> | |
<string>/tmp/aaronurgent.err</string> | |
<key>StandardOutPath</key> | |
<string>/tmp/aaronurgent.out</string> | |
</dict> | |
</plist> |
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 | |
# | |
# Runs every 15 seconds, see /Users/aaron/Library/LaunchAgents/com.aaron.urgent.plist | |
# | |
code=$(curl --silent --output /dev/null -w "%{http_code}" http://host.com/api/products/squirt-1-5-lts) | |
if [ "$code" -ne "200" ] | |
then | |
osascript -e "display notification \"SITE RETURNING $code\" with title \"MAJOR FUCKUP ALERT\"" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment