Archive old mothur logfiles

rather than overwriting the .logfile each time, please first rename the current logfile to an archive name (say, “mothur.logfile.nn” (incrementing nn each time).

I need the historical record, especially when debugging.

Using a bash script that counts all the log files in the directory, moves the latest log file to the name of the log file plus one. I tested it and it works on OS X 1.5.6. It should work on all Unix and Linux system running bash shells.

1 #!/bin/bash
2 # $file2increment
3 fname=$1
4 count=$(ls $fname* | wc -l)
5 let count=count+1
6 mv $fname $fname.$count
7 #
8 #Call Mothur here

I did it the lazy way and only rename the latest file and moves to the end not shifting all the file names up by one. If there are a number of files Tar & bzip, zip etc into one packed file before you increment the file. It will take some string manipulation.


that works, BUT…it would be better if it were built into mothur. That way, users will not have to do anything extra to keep historical information around for debugging purposes.

Thanks for the sugestions! In version 1.8, releasing early February, the logfiles will be time stamped and not overwritten with each execution of mothur.