Merge "Make cron's logrotate schedule configurable"
This commit is contained in:
commit
c8da829679
@ -21,5 +21,8 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
|
||||
|
||||
{{ macros.install_packages(cron_packages | customizable("packages")) }}
|
||||
|
||||
COPY extend_start.sh /usr/local/bin/kolla_extend_start
|
||||
RUN chmod 755 /usr/local/bin/kolla_extend_start
|
||||
|
||||
{% block cron_footer %}{% endblock %}
|
||||
{% block footer %}{% endblock %}
|
||||
|
17
docker/cron/extend_start.sh
Normal file
17
docker/cron/extend_start.sh
Normal file
@ -0,0 +1,17 @@
|
||||
#!/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')
|
||||
|
||||
# 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}."
|
Loading…
Reference in New Issue
Block a user