Test if status is different from "active"

This commit is contained in:
Jeremy Gardais 2023-02-03 16:25:49 +01:00
parent b0dc0934a4
commit ea4019a369
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
2 changed files with 2 additions and 2 deletions

View File

@ -251,7 +251,7 @@ main() { # {{{
debug_message "-- Connect VPN BEGIN" debug_message "-- Connect VPN BEGIN"
### If forticlient-scheduler.service unit is not started {{{ ### If forticlient-scheduler.service unit is not started {{{
systemd_forticlient_status=$(systemctl show --property ActiveState --value forticlient-scheduler.service || error_message "Error while requesting forticlient-scheduler.service unit status." 21) systemd_forticlient_status=$(systemctl show --property ActiveState --value forticlient-scheduler.service || error_message "Error while requesting forticlient-scheduler.service unit status." 21)
if [ "${systemd_forticlient_status}" = "inactive" ] || [ "${systemd_forticlient_status}" = "failed" ]; then if [ "${systemd_forticlient_status}" != "active" ]; then
debug_message "| Try to start forticlient-scheduler.service unit." debug_message "| Try to start forticlient-scheduler.service unit."
sudo systemctl restart forticlient-scheduler.service \ sudo systemctl restart forticlient-scheduler.service \
|| error_message "Error while (re)starting forticlient-scheduler.service unit" 22 || error_message "Error while (re)starting forticlient-scheduler.service unit" 22

View File

@ -250,7 +250,7 @@ main() { # {{{
debug_message "-- Connect VPN BEGIN" debug_message "-- Connect VPN BEGIN"
### If forticlient.service unit is not started {{{ ### If forticlient.service unit is not started {{{
systemd_forticlient_status=$(systemctl show --property ActiveState --value forticlient.service || error_message "Error while requesting forticlient.service unit status." 21) systemd_forticlient_status=$(systemctl show --property ActiveState --value forticlient.service || error_message "Error while requesting forticlient.service unit status." 21)
if [ "${systemd_forticlient_status}" = "inactive" ]; then if [ "${systemd_forticlient_status}" != "active" ]; then
debug_message "| Try to start forticlient.service unit." debug_message "| Try to start forticlient.service unit."
sudo systemctl restart forticlient.service \ sudo systemctl restart forticlient.service \
|| error_message "Error while (re)starting forticlient.service unit" 22 || error_message "Error while (re)starting forticlient.service unit" 22