I'm really struggling to understand how logrotate works when running a command within a shell file of my own, and how it doesn't.
The command in question is:
rclone -L -vv --log-file "/home/mike/tmp/qqq.log" sync "/media/mike/W10 D drive/My Documents/" remote:MyDocuments_M17A_from_Linux
What I would like:
I
I would like this qqq.log file to be checked quite often, say every 10 min., to see whether it has exceeded a given size, say 1 MB. And if it has, to rotate the file. rclone with the -vv option produces copious output, deliberately (i.e. to try to understand to get logrotate working for this use case).
There's a moderately helpful tutorial here, but it still leaves me in the dark:
How are you meant to configure rotation of logs from your own non-system processes? Are you meant to stick lines at the bottom of
/etc/logrotate.conf? This is what I have done (under "#system-specific logs may be configured here"):/home/mike/tmp/qqq.log { notifempty size 1M daily create 0664 root root rotate 3 }
later: I now realise you can also put individual files in /etc/logrotate.d - no great complexity there.Is it the case that by default
logrotateonly runs once a day, by virtue of the file/etc/cron.daily/logrotate?Does that mean that if I want much more frequent checking I should perhaps set up a
cronjob to do this, running (in this example) every 10 minutes?Are you meant to run
logrotate <config file>as root? I ask this question because I have tried both as root and as user. User didn't seem to work./home/mike/tmp/qqq.log { notifempty size 1M daily create 0664 root root rotate 3 }
later: I now realise you can also put individual files in /etc/logrotate.d - no great complexity there.
Is it the case that by default
logrotateonly runs once a day, by virtue of the file/etc/cron.daily/logrotate?Does that mean that if I want much more frequent checking I should perhaps set up a
cronjob to do this, running (in this example) every 10 minutes?Are you meant to run
logrotate <config file>as root? I ask this question because I have tried both as root and as user. User didn't seem to work.
A link to a beginner's guide to this sort of setup, which can't be that uncommon, would be helpful. I have searched but most of what I've found doesn't give you a step-by-step guide.