From 02e88d031483a247961667134fbdee4c951de8d5 Mon Sep 17 00:00:00 2001 From: Ethan Dye Date: Tue, 17 Dec 2024 21:23:32 -0700 Subject: [PATCH] Update shudown detection Signed-off-by: Ethan Dye --- zram-config | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/zram-config b/zram-config index 5422fd0..f3fe870 100755 --- a/zram-config +++ b/zram-config @@ -279,7 +279,7 @@ serviceConfiguration() { else if [[ $(systemctl is-active rsyslog.service) == "active" ]]; then export rsyslogActive="true" - if ! systemctl --no-block stop syslog.socket; then + if ! systemctl stop syslog.socket; then log "ERROR" "Failed to stop syslog service." return 1 fi @@ -290,7 +290,7 @@ serviceConfiguration() { log "ERROR" "Failed to flush journal." return 1 fi - if ! systemctl --no-block stop systemd-journald.socket systemd-journald-audit.socket systemd-journald-dev-log.socket; then + if ! systemctl stop systemd-journald.socket systemd-journald-audit.socket systemd-journald-dev-log.socket; then log "ERROR" "Failed to stop journald service." return 1 fi @@ -323,9 +323,8 @@ TMPDIR="/usr/local/lib/zram-config" ZDIR="/opt/zram" ZLOG="/usr/local/share/zram-config/log/zram-config.log" OS="$(grep -o '^ID=.*$' /etc/os-release | cut -d'=' -f2)" -RUNLEVEL="$(runlevel | cut -d' ' -f2)" -if [[ $RUNLEVEL == "1" ]] || [[ $RUNLEVEL == "6" ]]; then - SHUTDOWN="1" +if systemctl list-jobs | grep -q 'shutdown.target.*start' || systemctl list-jobs | grep -q 'reboot.target.*start'; then + SHUTDOWN=1 fi case "$1" in