Fix % to \% for cron CMD format.

Signed-off-by: James Antill <james@and.org>
This commit is contained in:
James Antill 2024-07-19 11:33:53 -04:00 committed by james
parent f40fef9316
commit dc56eb16c8

View file

@ -1,10 +1,12 @@
# Note % in the CMD is \n unless escaped:
# Compress host log files daily.
0 06 * * * root /usr/bin/find /var/log/hosts -type f -name "*.log" -print | grep -v "$(date +'/\%Y/\%m/\%d/')" | xargs -r -n1 xz -1 > /dev/null
# Compress this days log files from last month in fedora_stats.
# NOTE: We stop on the 28th, the rest will be caught in the monthly.
0 07 1-28 * * root /usr/bin/find "/mnt/fedora_stats/combined-http/$(date --date='1 Month ago' +%Y/%m/%d)" -type f -name "*.log" -print | xargs -r -n 1 -P 2 nice xz -1 > /dev/null
0 07 1-28 * * root /usr/bin/find "/mnt/fedora_stats/combined-http/$(date --date='1 Month ago' +\%Y/\%m/\%d)" -type f -name "*.log" -print | xargs -r -n 1 -P 2 nice xz -1 > /dev/null
# Compress entire month from _two_ months ago log files in fedora_stats.
# NOTE: We don't do it on the 1st for an abundance of caution.
0 08 8 * * root /usr/bin/find "/mnt/fedora_stats/combined-http/$(date --date='2 Month ago' +%Y/%m)" -type f -name "*.log" -print | xargs -r -n 1 -P 2 nice xz -1 > /dev/null
0 08 8 * * root /usr/bin/find "/mnt/fedora_stats/combined-http/$(date --date='2 Month ago' +\%Y/\%m)" -type f -name "*.log" -print | xargs -r -n 1 -P 2 nice xz -1 > /dev/null