Editing Rotate_Logs.sh

I am trying to edit /mios/usr/bin/Rotate_Logs.sh to change max_rotation_interval to 24 hours so I get a chance to see errors in the log. WinSCP reports that this is a read-only file. Is there a way to make it editable?

/mios is a read-only file system (it’s got all the closed-source bits that MCV has added to OpenWrt to make it a Vera). You can’t write to it because it’s in flash memory.

Fortunately you don’t usually need to hack /mios/… files directly because they are (should be) never invoked directly; there is always a layer of indirection which you can change. Find the (mutable) symlink that points to the path on /mios/… and make it point somewhere else where you can write to. Something like:

[code]# cp /mios/usr/bin/Rotate_Logs.sh /root

ln -sf /root/Rotate_Logs.sh /usr/bin/Rotate_Logs.sh

vi /root/Rotate_Logs.sh

[/code]

Thanks for that, @futzle. I’ve made an edited copy of the script and redirected the link to it. Hopefully I shall now get a little longer to check the log before it gets rotated.

Works a treat. ;D I finally got to see what Vera gets up to whilst I’m asleep. Frightening… :o

Edit: I am investigating a problem with this. I’ll update when I solve it.

In case anybody else fancies trying this, here’s the procedure. This assumes that you have WinSCP installed and can connect to Vera. See WinSCP.
The objective is to have Vera rotate log files every 24 hours instead of 12 so you get more of a chance to track down problems. This is only worth doing if you are logging to USB. I suggest that you don’t try this unless you are comfortable using FTP and editing files.

Copy the Vera file /mios/usr/bin/Rotate_Logs.sh to a folder on your PC.
Copy it back to Vera folder /usr
Edit /usr/Rotate_Logs.sh by right-click and select Edit.
Change the line: max_rotation_interval=43200 #12hours to max_rotation_interval=86400 #24hours
Save the file and close the editor.

Open a PuTTY window with Commands, Open in PuTTY and Login as: root. You will need your root password.
Enter: ln -sf /usr/Rotate_Logs.sh /usr/bin/Rotate_Logs.sh

I am not sure what degree of restart is necessary to have Vera start using the modified file. Personally I went for a big one by entering reboot in the PuTTY window.

Hmm. My logs have stopped rotating at all. Not quite what I wanted. I switched back to the original file until I figure out what is happening.

ln -sf /mios/usr/bin/Rotate_Logs.sh /usr/bin/Rotate_Logs.sh

Would modifying the crontab entry to execute the Rotate_Logs.sh script at a longer interval (by default it is set to run every minute or */1) help extend the capacity of the log files? I set mine to run every hour… crossing my fingers.

ssh into your Vera using “root” and the root password. “crontab -e” will allow you to change crontab entries. I already commented out the Sync_Ergy crontab entry (I don’t use Ergy).

You can edit the crontab entry a bit easier than doing a soft link to the read-only Rotate_Logs.sh file :-).

There may be something in Vera that depends on running this script every minute (dunno), but if ROTATING LOGS is the only true function, and you have tons of space (i.e. the external USB drive), I would think you can afford to run this script every week?

No good, my LuaUPnP.log file still recreates every minute LOL.

I tried modifying the crontab entry to run every hour instead of every minute “*/1 " to " 0”; still rotates on the 1 min schedule.
I tried commenting out the crontab entry entirely; still rotates on the 1 min schedule.
I tried making a copy of Rotate_Logs.sh in /usr (not sure why the copy to the PC is required), used vi to edit it to increase the MAX_ROTATION_INTERVAL, and then setup a soft link to it; still rotates on the 1 min schedule.

Argh!

I’m out of ideas :-).

I never did get my mods to work. I decided that there is some unseen mechanism at work. Almost every change I have tried to Vera’s scripts has had some side effect. It stopped being important after I started using EventWatcher logging to a SysLog server.

On the occasions where I need to see the whole log over longer periods, I temporarily turn off Archive old logs on server so Vera keeps the rotated files.

[quote=“RexBeckett, post:9, topic:176656”]I never did get my mods to work. I decided that there is some unseen mechanism at work. Almost every change I have tried to Vera’s scripts has had some side effect. It stopped being important after I started using EventWatcher logging to a SysLog server.

On the occasions where I need to see the whole log over longer periods, I temporarily turn off Archive old logs on server so Vera keeps the rotated files.[/quote]

Perfect; turning off the “Archive old logs on server” appears to do the trick. The date on the log file keeps changing every minute… BUT the data keeps accumulating!