Rotating logs, a script - especially useful for Freesco boxes
Logs in a Freesco-box are limited by default: /var/log (or actually var) is mounted on RAM.
Since my Freesco-box is small, like most boxes around with Freesco, and I have Exim running, I felt the need for rotating exim logs. logrotate is an expensive solution for these boxes.
Limited RAM space looks like this:
[Linux] df /Having logs on RAM improves speed, but if space runs out, Exim just dies.
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/ram0 2901 2005 896 69% /
Fortunately since v0.3.2 there is an almost (*) automatic detection of lost network. In this case network is shut down and restarted, along with a nice rc_user stop and start. This is handled in Freesco rc scripts as newip. I also stop and start Exim in such cases; it is not necessary, but since network is down anyway, it gives me some advantage to use this restart to spin logs around.
At my rc_user I call the script fbox_save_logs.sh in-between rc_exim stop and rc_exim start:
fbox_save_logs.sh is, so to speak, a poor parent of logrotate, but does its job nicely in this small box.
Refer to:
(*)
It is written "almost" detects, because due to a Kernel bug, network hangs sporadically.
Try this script, if suits for your Freesco-box:


0 Comments:
Enviar um comentário
<< Home