Created
January 4, 2015 20:57
-
-
Save outadoc/0bcf37734c949e892f44 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
### colors | |
RED="\e[0;31m" | |
GREEN="\e[0;32m" | |
CLR="\e[0m" | |
echo "" | |
### check internet connectivity | |
INTERNET_WGET=`wget -q --tries=10 --timeout=20 -O - http://google.com > /dev/null` | |
INTERNET_STATUS="${RED}DOWN$CLR" | |
if [[ "$INTERNET_WGET" -eq 0 ]]; then | |
INTERNET_STATUS="${GREEN}UP$CLR" | |
fi | |
echo -e "Internet connection...\t $INTERNET_STATUS" | |
### check if node is running | |
NODE_INSTANCES=`ps aux | grep node | grep -v grep | wc -l` | |
NODE_STATUS="${RED}NO$CLR" | |
if [[ "$NODE_INSTANCES" -gt 0 ]]; then | |
NODE_STATUS="${GREEN}YES$CLR ($NODE_INSTANCES instance(s))" | |
fi | |
echo -e "Node running...\t\t $NODE_STATUS" | |
### check if the pushover bot is running | |
PUSH_PID=`cat ~/tasks/twitter-mentions-pushover/node_lock` | |
PUSH_STATUS="${GREEN}YES$CLR" | |
if ! kill -0 $PUSH_PID > /dev/null 2>&1; then | |
PUSH_STATUS="${RED}NO$CLR" | |
fi | |
echo -e "Pushover bot running...\t $PUSH_STATUS" | |
### print a portal quote | |
echo "" | |
fortune -s 33% glados 33% wheatley cave_johnson | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment