Created
January 4, 2019 08:40
-
-
Save maesoser/11635c9bec822d28a466287b46220fde to your computer and use it in GitHub Desktop.
Quick and dirty process monitor, something like Monit
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
#!/usr/bin/env bash | |
FAIL='\033[0;31m' | |
OK='\033[0;32m' | |
END='\033[0m' # No Color | |
declare -a arr=("rsyslogd" "crond" "noelement") | |
## now loop through the above array | |
for i in "${arr[@]}" | |
do | |
pid=$(pgrep -o -f $i) | |
if [ $? -eq 0 ]; then | |
printf "${OK}[$pid]${END}\t$i\n" | |
else | |
printf "${FAIL}[FAIL]${END}\t$i\n" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment