linux script check if process exists code example
Example: bash check if process is running by name
if pgrep -x "<PROCESS_NAME>" > /dev/null; then
echo "Running"
else
echo "Not running"
fi
if pgrep -x "<PROCESS_NAME>" > /dev/null; then
echo "Running"
else
echo "Not running"
fi