Check for process and kill if running Linux

Check for process and kill if running Linux

if pgrep process_name 2>/dev/null; then
  echo "Terminating process_name"
  pkill process_name
fi

Source: unix.stackexchange.com