Cronjob for noobs (help)

OS type and version Ubuntu 20.04
Virtualmin version 7.7

So I have never done a cron job before in my life.
I want to set one for /home/domain/logs/php_log to delete the file and remake it

is this easy to do?

Thank you!

That is a special case. What you’re wanting to do is called log rotation, and there is a tool for it already on your system called logrotate.

That service should already be rotating any logs created by Virtualmin. If it is not rotating fast enough or keep old rotated logs longer than you want (for disk space or data retention policy reasons), you should change the configuration of logrotate, rather than making your own cronjobs.

That said, I believe there is a known bug on some systems where the php_log isn’t being rotated. I don’t remember details, but it should be searchable.

Thank you for the reply.

Had virtualmin up for 2 days and my access log for one domain is at 5.5gb this is why I was asking about it.

I found it and changed it to daily instead of weekly and worked amazing!

Thank you Joe!

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.