Skip to content

Instantly share code, notes, and snippets.

@HR
Created May 16, 2016 16:40
Show Gist options
  • Save HR/1b911a48510c4fe8f35843f8793db47f to your computer and use it in GitHub Desktop.
Save HR/1b911a48510c4fe8f35843f8793db47f to your computer and use it in GitHub Desktop.
Check if processes are running bash
#!/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