Re: get the timestamp as a log filename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



which does not produce a file name that sorts the way I like.
I would use something like...

  $ date +"%Y-%m-%d_%R"
  2004-01-23_09:01

That's highly recommended, although %Y-%m-%d generally suffices, since logrotate won't run more than once per day unless forced.


Dropping something like the following in the appropriate section of logrotates.conf or logrotate.d appears to work splendidly, if you want to keep these logs indefinately. You may also want to use 'rotate 0'.

I used /etc/logrotate.d/rpm for testing:

postrotate
   /bin/cp /var/log/rpmpkgs.1 /var/log/rpmpkgs-`/bin/date +"%Y-%m-%d-%R"`
endscript




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux