Skip to content

Instantly share code, notes, and snippets.

@maxaudron
Created March 7, 2017 09:27
Show Gist options
  • Save maxaudron/4c6e8fa5c105477ce8adeace92ca7614 to your computer and use it in GitHub Desktop.
Save maxaudron/4c6e8fa5c105477ce8adeace92ca7614 to your computer and use it in GitHub Desktop.
#!/bin/bash
# ----------------------------------------
# Checks if procceses are running and
# outputs neatly formated overview
#
# Usage: pcheck $1 $2 $3
# ----------------------------------------
for program in $@
do
if [ $(pidof $program | wc -w) = 1 ]
then
echo -en "$program : \033[0;32mrunning\033[0m\n"
else
echo -en "$program : \033[0;31mstopped\033[0m\n"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment