Hi. I am using OpenWRT on a Netgear R7800. This works quite well so far. Today I connected a USB stick and it is also mounted during boot. After that I set the following.
config system
...
option log_file '/path/to/mylog'
From then on the log was written cleanly to the USB stick. Unfortunately this does not work after a reboot. As soon as I restart the log service, the logging to the file works again. Does anyone have an idea what I can do?
right. The only change I'd recommned is that you move your workaround into another script and then call that script from rc.local (instead of having the script itself all inside rc.local).
The workaround is the only way to do this because you cannot guarantee when your storage is mounted vs when the logger service reads the desired log location. So simply restarting the logger service after the drive has mounted will solve the issue.
I am not sure I'd delay the startup of the logging service -- at least when it starts, it's logging to tmp space, so you can still see what is going on. If it is delayed, you wouldn't see the logs until much later -- possibly too late to catch something interesting that might need to be examined.
That's true. But if restarting the logging service is a viable method of achieving the goal without compromising the early log data, why bother changing its start order (which, BTW, may or may not actually help -- the S number is specifically the start order, but there is no guarantee that the previous tasks have completed prior to next process starting).