Skip to content

Instantly share code, notes, and snippets.

@vinzdef
Created October 8, 2014 13:28
Show Gist options
  • Save vinzdef/606405fee3475a98f598 to your computer and use it in GitHub Desktop.
Save vinzdef/606405fee3475a98f598 to your computer and use it in GitHub Desktop.
Check if process is running
#check if a process named X is running
if [ -z "$(pidof X )" ] #CHANGE X WITH PROCESS NAME
then
# process was found
else
# process not found
fi
#ALSO
#check if process CONTAINING X is running
if [ -z "$(pgrep X )" ] #CHANGE X WITH PROCESS NAME
then
# process was found
else
# process not found
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment