| {%- from "apache/map.jinja" import server with context %} |
| job: |
| apache2: |
| - files: |
| - /var/log/apache2/*.log |
| options: |
| - daily |
| - missingok |
| - rotate: 14 |
| - compress |
| - delaycompress |
| - notifempty |
| - sharedscripts |
| - prerotate: |
| RANDOM=$(( $(dd if=/dev/urandom bs=2 count=1 2> /dev/null | cksum | cut -d' ' -f1) % 32767 )); |
| RANDOM_START={{ server.logrotate.start_period }}; |
| RANDOM_END={{ server.logrotate.end_period }}; |
| RANGE=$(( $RANDOM_END - $RANDOM_START )); |
| RESULT=$(( $RANDOM % $RANGE)); |
| RESULT=$(( $RESULT + $RANDOM_START )); |
| sleep $RESULT |
| - postrotate: "if /etc/init.d/apache2 status > /dev/null; then /etc/init.d/apache2 reload > /dev/null; fi" |