0

I'm running a program called gatk-picard.sh and it's printing out the running history/log (INFO* rows below). Since the program will take about 20 hours to finisn and I wanted to put it on running when I am leaving my office but would check the running history in my home. How to save these history lines automatically after it's done?

What I have tried was $gatk-picard.sh > log but seems not working.

$ ./gatk-picard.sh 
INFO  16:08:50,858 HelpFormatter - -------------------------------------------------------------------------------- 
INFO  16:08:50,861 HelpFormatter - The Genome Analysis Toolkit (GATK) v3.6-0-g89b7209, Compiled 2016/06/01 22:27:29 
INFO  16:08:50,861 HelpFormatter - Copyright (c) 2010-2016 The Broad Institute 
INFO  16:08:50,862 HelpFormatter - For support and documentation go to https://www.broadinstitute.org/gatk 
INFO  16:08:50,862 HelpFormatter - [Fri Sep 16 16:08:50 EDT 2016] Executing on Linux 3.13.0-95-generic amd64 
INFO  16:08:50,862 HelpFormatter - Java HotSpot(TM) 64-Bit Server VM 1.8.0_102-b14 JdkDeflater 
linux
David Z
  • 6,641
  • 11
  • 50
  • 101
  • have you tried `gatk-picard.sh 2&>1 > log` – Jean-François Fabre Sep 16 '16 at 20:20
  • no, what does `2&>1` means? – David Z Sep 16 '16 at 20:21
  • 1
    redirect error output to standard output. – Jean-François Fabre Sep 16 '16 at 20:22
  • Use nohup as well - perhaps read this - http://stackoverflow.com/questions/13676457/how-can-i-put-the-current-running-linux-process-in-background/13676865#13676865 – Ed Heal Sep 16 '16 at 20:23
  • 1
    You could also run the program under `screen` or `tmux`. This will allow you to detach the terminal and reconnect to it later. – Barmar Sep 16 '16 at 20:50
  • 1
    To expand on Barmar's comment, `tmux` will not only allow you to 'connect later', but you can go home and connect to the tty remotely. (`screen` will also let you do that, but if you are not yet familiar with these tools I strongly recommend learning `tmux` rather than `screen`. The functionality is similar, but (IMO) `tmux` is superior.) – William Pursell Sep 16 '16 at 22:31

1 Answers1

0

Use nohup Utility

If you don't need to interact with the script, you can run it under nohup:

nohup gatk-picard.sh &

You can then read or monitor the logfile, even while the program continues to run. For example:

tail -F nohup.out
Todd A. Jacobs
  • 81,402
  • 15
  • 141
  • 199