Can logrotate apply multiple rotate rules?

New to Debian (Or Linux in general)? Ask your questions here!

Re: Can logrotate apply multiple rotate rules?

Postby PsySc0rpi0n » 2020-06-13 11:52

sickpig wrote:so whats stopping you from using systemd.timer as opposed to cron?

I had this working with cron in that past. I see no need to change it now. I want to keep the thread focused in cron and logrotate if possible. After I get this working, I may try systemd.time or whatever that is.

But in the meantime, I read a bit more and did the follwoing:

Created a file named 'myfile' in:
Code: Select all

and set the following configs in it for logrotate:
Code: Select all
/media/wdelements/debug.log {
    rotate 5
    size 50M
    dateformat -%d%m%Y
    maxage 31

Then, I created a bah script inside
Code: Select all

With the following content:
Code: Select all

if [ -f /etc/logrotate.d/myfile ]; then
   logrotate --verbose /etc/logrotate.d/myfile
   echo "File not found!"

And despite logrotate is set to run daily by default, I think this should do the trick, no?
User avatar
Posts: 205
Joined: 2012-10-24 13:54
Location: Portugal


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 12 guests