logrotate can be run as an ordinary user, without administrative privileges, to rotate logs for that user.
# Create a local per-user configuration file
cat >.logrotate.conf <<'X'
/home/mike/tmp/qqq.log {
notifempty
size 1M
dailymissingok
create 0664 mikesize mike1M
rotate 3
}
X
# Run logrotate with that configuration file
/usr/sbin/logrotate -v -s .logrotate.state .logrotate.conf
You'll find that the first time it runs, nothing happens. This is becauseI've removed your logrotatedaily has no initial state so it needs to set it up. In your casecriterion because you wanted purely a size-based check, regardless of the number of timesand this would have limited any possible action to just once a day (the first time each day that logrotate is re-runrun, no further changes will be made until specified criteria have been met (i.eas it happens). I've replaced notifemptycreate, with size 1Mmissingok, so that it's up to your actual dailyrclone). You can cheat by editing job to create the output file rather than .logrotate.state file if you are comfortable doing so, rolling its time value back at least one day.
Then put the logrotate command into your user's crontab file:
# Capture any existing crontab entries
crontab -l >.crontab
# Append ours to the list
echo '0 * * * * /usr/sbin/logrotate -s .logrotate.state .logrotate.conf >>.crontab.log 2>&1' >>.crontab
# Reload crontab
crontab .crontab
Using this example, output from the command will be written to .crontab.log, and you'll probably want a logrotate entry to cycle or reset it monthly.