Exclude grep from ps -ef result
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user