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"
|
pretty_service_name="$process_name"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the process is running
|
if uname | grep -q "BSD"; then
|
||||||
process_count=$(pgrep -f "$process_name" 2>/dev/null | wc -l)
|
# 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
|
if [ $? -ne 0 ]; then
|
||||||
echo "UNKNOWN - Check failed"
|
echo "UNKNOWN - Check failed"
|
||||||
|
|
Loading…
Reference in New Issue