#!/bin/sh
# Copyright (C) 2025 Checkmk GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

ls ~/var/check_mk/backup/*.state >/dev/null 2>&1 && {
    echo "<<<mkbackup>>>"
    for statefile in ~/var/check_mk/backup/*.state; do
        job_ident=${statefile%.state}
        job_ident=${job_ident##*/}

        if [ "${job_ident}" != "restore" ]; then
            echo "[[[site:$(whoami):${job_ident}]]]"
            cat "${statefile}"
            echo
        fi
    done
}
