Created
May 16, 2016 16:40
-
-
Save HR/1b911a48510c4fe8f35843f8793db47f to your computer and use it in GitHub Desktop.
Check if processes are running bash
This file contains hidden or 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 | |
for proc in "$@" | |
do | |
RUNNING=$(pgrep $proc) | |
if [[ $RUNNING ]] | |
then | |
# do stuff if running | |
echo "$proc is running" | |
else | |
# do stuff if not running | |
echo "$proc is not running" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment