Category: pgrep

Bash check if process is running or not on Linux / Unix – nixCraft:

Is process running or not my Linux or Unix box? 

pgrep -x nginx >/dev/null && echo “Running”
ps -C mysqld >/dev/null && echo “Yes”

See how to determine whether a process is running or not and use a conditional shell script to start/stop process