Browse Source

fix: dev: [logrotate] clean code !minor

rsync-stats
Valentin Lab 3 weeks ago
parent
commit
2fbfd0a8fa
  1. 7
      logrotate/build/src/entrypoint.sh

7
logrotate/build/src/entrypoint.sh

@ -1,13 +1,12 @@
#!/bin/sh
# Clean non existent log file entries from status file
cd /var/lib/logrotate
cd /var/lib/logrotate || return 1
test -e status || touch status
head -1 status > status.clean
sed 's/"//g' status | while read logfile date
do
sed 's/"//g' status | while read -r logfile date; do
[ -e "$logfile" ] && echo "\"$logfile\" $date"
done >> status.clean
mv status.clean status
/usr/sbin/logrotate -v -s /var/lib/logrotate/status /etc/logrotate.conf
exec /usr/sbin/logrotate -v -s /var/lib/logrotate/status /etc/logrotate.conf
Loading…
Cancel
Save