Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to archive log directory from shell script?

I have a shell script that starts a roslaunch file. I use a shell script, because I provide some arguments before I start the roslaunch.

I'd like to also archive and copy the current log directory for the running roscore process. I know that by running roscd log, I get to the this current directory, but I cannot somehow get to this directory from the shell script.

I tried assigning it to a variable:

log_dir=$(roscd log)

and then running tar -zcvf $log_dir -C $output_dir

But of course nothing is stored in my variable. I am not sure even if this is the correct approach. But I am asking here, as there might be some better ROS specific way of doing such a task.

So, what is the best way to this? Since the name of the log folder is always dynamically generated.

Thanks in advance!