diff --git a/hooks/post_iptable_rules b/hooks/post_iptable_rules index b47e590..d44f347 100644 --- a/hooks/post_iptable_rules +++ b/hooks/post_iptable_rules @@ -1,7 +1,6 @@ #/bin/bash -if [[ $(systemctl status __APP__.service | grep "Active" | cut -d'(' -f2 | cut -d ')' -f1) = 'running' ]] -then +if systemctl is-active __APP__.service --quiet; then systemctl stop monitorix.service sleep 1 pkill -f "monitorix-httpd listening on" || true diff --git a/scripts/backup b/scripts/backup index ab04045..ce158a9 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,7 @@ load_vars #================================================= # STOP SYSTEMD SERVICE #================================================= -if [[ ! "$(systemctl status $app.service)" =~ "Active: inactive (dead)" ]]; then +if systemctl is-active $app.service --quiet; then ynh_print_warn --message="It's highly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'" fi