#!/bin/sh
# LightDM runs this as root after authentication. A non-zero exit cancels
# the session, so this script always exits 0.
set -u

STATE=${ZOS_LOG_COLLECTOR_STATE:-/var/lib/zos-log-collector}

if [ -f "$STATE/collect-pending" ] && command -v systemctl >/dev/null 2>&1; then
    systemctl start --no-block zos-log-collector-capture.service || true
fi
exit 0
