kolla/docker/cron/extend_start_el9.sh
Michal Nasiadka 82ee1e6319 Add support for CentOS Stream 9
This changeset adds support for CentOS Stream 9.

Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/864920

Change-Id: I113b9984294cf8663d3fc0c8840320e1d40ea731
(cherry picked from commit 878b00013b)
2023-02-17 06:28:58 +00:00

22 lines
894 B
Bash

#!/bin/bash
CRON_LOGROTATE_CURRENT_PATH="$(find /etc/cron* -name logrotate)"
CRON_LOGROTATE_CURRENT_SCHEDULE=$(echo "${CRON_LOGROTATE_CURRENT_PATH}" | sed -r 's/(.*)(hourly|daily|weekly|monthly)(.*)/\2/g')
if [ -z $CRON_LOGROTATE_CURRENT_PATH ]; then
echo "logrotate is not handled by cron"
else
# Pass only for hourly|daily|weekly|monthly
if [[ "${KOLLA_LOGROTATE_SCHEDULE:-undefined}" =~ hourly|daily|weekly|monthly ]]; then
CRON_LOGROTATE_DESIRED_PATH="/etc/cron.${KOLLA_LOGROTATE_SCHEDULE}/logrotate"
if [[ "${CRON_LOGROTATE_CURRENT_PATH}" != "${CRON_LOGROTATE_DESIRED_PATH}" ]]; then
mv ${CRON_LOGROTATE_CURRENT_PATH} ${CRON_LOGROTATE_DESIRED_PATH}
CRON_LOGROTATE_CURRENT_SCHEDULE="${KOLLA_LOGROTATE_SCHEDULE}"
fi
fi
echo "[i] Cron schedule for logrotate is currently set to: ${CRON_LOGROTATE_CURRENT_SCHEDULE}."
fi