AutomaticRun.sh script works perfectly fine, it just writes a lotta junk to a file and then cuts it via tail command. you can implement a buffer in memory to save all the results for that file while the command (a model) is being run, and then, when it is finished you directly write the last 20 lines to the file, then flush the buffer; or another approach is that you can only keep the last 20 letters in the buffer and then when the command is finished, write them to a file and flush the 20-line buffer. i think the second approach is better if it could be done in a bash script.