Set log deletion to daily (not hourly) for Log Option #1

I would like to use the ramdisk /var/log for my own logs but I want the dietpi-cleaner cron job to run daily at a specific time rather than hourly. This is so that I can schedule another job to copy my log files out to SD just before they are deleted from the RAM disk. I have an MQTT message log that would otherwise be writing to SD every couple of seconds. I’m happy for all /var/log to be deleted daily.

What would be the best way of achieving this? I haven’t used crontab before and crobtab-ui installation didn’t go well so I removed it.

Also what’s the best way of changing the RAM disk size in case I need more than 50MB? (which is what df says it currently has)

Cheers

Basically our script has this hardcode to run on hourly basis. It’s located at /etc/cron.hourly/dietpi

Did you already try Option #2? This will save logs to /root/logfile_storage before deletion.

1 Like

@Joulinar Thanks for your reply.

I’ve had a look at option 2 but that will copy all the logs to SD.

I’ve decided to use the /run/ directory which is also mounted on tmpfs (the ramdisk) but isn’t affected by the cleaner script and whose content is only lost at reboot. I then have a daily cron job run under my user to move the files from ram disk to a directory on the SD card in my home directory.

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