Merge pull request #1238 from pkishino/healthfix2

Exclude grep from ps -ef result
This commit is contained in:
Kristian Haugene
2020-07-08 00:38:49 +02:00
committed by GitHub

View File

@@ -23,15 +23,15 @@ echo "Network is up"
#Service check #Service check
#Expected output is 2 for both checks, 1 for process and 1 for grep #Expected output is 2 for both checks, 1 for process and 1 for grep
OPENVPN=$(ps -ef | grep 'openvpn --script-security' |wc| awk '{print $1}') OPENVPN=$(pgrep openvpn | wc -l )
TRANSMISSION=$(ps -ef | grep 'transmission-daemon' |wc| awk '{print $1}') TRANSMISSION=$(pgrep transmission | wc -l)
if [[ ${OPENVPN} -ne 2 ]] if [[ ${OPENVPN} -ne 1 ]]
then then
echo "Openvpn process not running" echo "Openvpn process not running"
exit 1 exit 1
fi fi
if [[ ${TRANSMISSION} -ne 2 ]] if [[ ${TRANSMISSION} -ne 1 ]]
then then
echo "transmission-daemon process not running" echo "transmission-daemon process not running"
exit 1 exit 1