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.sickpig wrote:so whats stopping you from using systemd.timer as opposed to cron?
But in the meantime, I read a bit more and did the follwoing:
Created a file named 'myfile' in:
Code: Select all
/etc/logrotate.d
Code: Select all
/media/wdelements/debug.log {
rotate 5
daily
copytruncate
size 50M
dateext
dateformat -%d%m%Y
maxage 31
}
Code: Select all
/etc/cron.hourly
Code: Select all
#!/bin/bash
if [ -f /etc/logrotate.d/myfile ]; then
logrotate --verbose /etc/logrotate.d/myfile
else
echo "File not found!"
fi