Score:0

Is there a way to run logrotate of a specific application's logs only at times other than midnight?

ca flag

I put the file I set in the "logrotate.d folder".

And I wanted to run the file only at 00:30 every day through "crontab -e".

However, when I checked the next day, it was executed at 00:00 and also at 00:30.

After searching and checking, I found out that cron.daily has logrotate set up, and logrotate is set to run at 00:00 by default.

So, it was executed at 00:00 and at 00:30 that I set, confirming that it was executed twice.

I tried to modify logrotate in cron.daily, but it seemed difficult to exclude only certain files because the system log was also set.

Is there a way to run logrotate only at certain times of the day? I would be grateful if you let me know if there is!

waltinator avatar
it flag
Read `man logrotate logrotate.conf;man -a crontab`. Remove your file from `logrotate.d` directory, undo your "modify logrotate in cron.daily". You can easily set up your `00:30` `cron`job to rotate your logs using your own `logrotare.conf`. Let the system rotate its logs (but not your log) at `00:00`.
john_smith avatar
ca flag
@waltinator / Does it still mean there is no logrotate file I have set up in the logrotare.conf folder?
waltinator avatar
it flag
From `man logrotate`: `logrotate [-dv] [-f|--force] [-s|--state file] config_file`, so you can have your logrotate configuration file anywhere. The `logrotate.d/` directory is used by multiple developers. It's easier and safer for a log-producing package to simply add its logrotation configuration as a file in `logrotate.d`. The other way involves each package developer figuring out how to parse the common `logrotate.conf`, so as to safely add their data. You, as a single rotator, do not need this complexity. Use a simple, `mylogrotate.conf`. ..
john_smith avatar
ca flag
@waltinator Thanks!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.