diff --git a/check_process.sh b/check_process.sh index 2cc11d7..3fcd919 100755 --- a/check_process.sh +++ b/check_process.sh @@ -38,8 +38,12 @@ if [ -z "$pretty_service_name" ]; then pretty_service_name="$process_name" fi -# Check if the process is running -process_count=$(pgrep -f "$process_name" 2>/dev/null | wc -l) +if uname | grep -q "BSD"; then + # have to run pgrep with sudo in BSD + process_count=$(sudo pgrep -f "$process_name" 2>/dev/null | wc -l) +else + process_count=$(pgrep -f "$process_name" 2>/dev/null | wc -l) +fi if [ $? -ne 0 ]; then echo "UNKNOWN - Check failed"