check_process.sh: fix bsd
This commit is contained in:
parent
f4732d2fd5
commit
5a34281bde
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue