Hallo,
Bisher heißen die von Logrotate erstellten Archive xyv.log.1/2/3/.../n.gz
Wie kann ich statt der angehängten Zahlen das aktuelle Datum einfügen?
In den Man-Seiten von Logrotate habe ich keine spezielle Option gefunden, nur für die Endungen, aber das ist ja nicht das, was ich ändern möchte.
Mit freundlichen Grüßen,
Marcus Hammel
von Logrotate erstellte Archive nach bestimmten Schema benennen
Re: von Logrotate erstellte Archive nach bestimmten Schema benennen
Script schreiben oder Logrotate patchen...
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Re: von Logrotate erstellte Archive nach bestimmten Schema benennen
Habe es nun folgendermaßen gelöst:
Code: Select all
/var/log/apache2/.../*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
EXT=`date +%d%m%Y`
for f in $1;
do mv $f.2.gz $f.$EXT.2.gz;
done
if [ -f /var/run/apache2.pid ]; then
/etc/init.d/apache2 restart > /dev/null
fi
endscript
}