Conditional emptying of log files for node without deleting the file
Dear Experts,
As per my system architecture there is a need to take archives of logs under ~/.ros/log/latest/ folder. However in our operation we are not allowed to stop and restart rosmaster and all the nodes. Hence the symlink of the latest folder will be perennial as well as the log files will be appended each time the node is exercised. What we need is to clear the content of the *.log files on an event (which could be read from a suitable rostopic). The event marks a culmination of a particular cycle of oepration and hence the logs between the event is relevant for relating it to a cycle.
The command
rosclean purge -y
Is not helpful as it clears off the folder and the handle to the files are lost. After that unless and until the all the nodes and rosmaster is restarted the logging will not commence.
Is there a way we can issue emptying of the *.log files on an event with the constraint that the rosmaster and nodes cannot be shutdown/killed.
The following crude solultion does not yield proper result
for logs in ~/.ros/log/latest/*.log; do
echo "" > $logs
done
Any help will be appreciated
Regards Shouvik