Change ps check string (add a second one).
This commit is contained in:
parent
762e6116d9
commit
24ba503a6f
10
check_vpn.sh
10
check_vpn.sh
@ -2,9 +2,11 @@
|
||||
|
||||
check_string_ps=""
|
||||
if [[ -f "/usr/sbin/openvpn" ]] ; then
|
||||
check_string_ps="/usr/sbin/openvpn --daemon"
|
||||
check_string_ps="/usr/sbin/openvpn"
|
||||
fi
|
||||
|
||||
check_string_ps_plus="--daemon"
|
||||
|
||||
|
||||
# - used, if systemd is NOT supported
|
||||
init_script=""
|
||||
@ -123,7 +125,7 @@ if $LOGGING ; then
|
||||
echo -e " ====================================="
|
||||
fi
|
||||
|
||||
PID=$(ps -e f | grep -E "[[:digit:]]\ ${check_string_ps}"| grep -v grep | awk '{print$2}')
|
||||
PID=$(ps -e f | grep -E "[[:digit:]]\ ${check_string_ps}" | grep "\ ${check_string_ps_plus}\ " | grep -v grep | awk '{print$2}')
|
||||
if [[ "X${PID}" = "X" ]]; then
|
||||
|
||||
error "OpenVPN Service seems to be down! Trying to restart service now.."
|
||||
@ -151,10 +153,10 @@ if [[ "X${PID}" = "X" ]]; then
|
||||
fi
|
||||
|
||||
declare -i counter=0
|
||||
PID=$(ps -e f | grep -E "[[:digit:]]\ ${check_string_ps}"| grep -v grep | awk '{print$2}')
|
||||
PID=$(ps -e f | grep -E "[[:digit:]]\ ${check_string_ps}" | grep "\ ${check_string_ps_plus}\ " | grep -v grep | awk '{print$2}')
|
||||
while [[ "X${PID}" = "X" ]]; do
|
||||
sleep 1
|
||||
PID=$(ps -e f | grep -E "[[:digit:]]\ ${check_string_ps}"| grep -v grep | awk '{print$2}')
|
||||
PID=$(ps -e f | grep -E "[[:digit:]]\ ${check_string_ps}" | grep "\ ${check_string_ps_plus}\ " | grep -v grep | awk '{print$2}')
|
||||
if [[ $counter -gt 10 ]]; then
|
||||
break
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user