Automatic Rotate of Logs

Here’s what I want to do, I want only my queue_log to be rotated daily with the format queue_log..bak

Also, I want it to do this on bootup, with the format queue_log..n.bak, where n is an incremental number if the file exists.

I know it can be done with rc.local and cron but I barely have bash experience.




#!/bin/sh tdy=`date +%Y%m%d` /usr/sbin/asterisk -rx 'logger rotate' /bin/mv /var/log/asterisk/queue_log.0 /var/log/asterisk/queue_log.$tdy.bak

this is slightly different from what we do, but i just copied and pasted the code and made a few changes for your naming scheme.

works great for me.

Thanks! :open_mouth: