0

I'm on a linux machine.

I would like to run four perl scripts on a remote server. Each script produces a single output file but it can take hours to run. I would like to run the scripts in the background such that if I'm disconnected from the server, exit from the shell prompt or log out, it will continue running. These scripts also print out lines to the command terminal as it's running. I would like to be able check the print statements the script is printing to the command terminal.

I would normally use the screen -S command to create a screen. Then press CTRL+A CTRL+D to detach and screen -r to reattach to the screen but the remote server I'm on doesn't have screen. And I don't have sudo access to install it.

How do I run these 4 perl scripts at the same time in the background on the remote server?

For example say my script is called gene1.pl, how do I do this? I tried doing nohup perl gene1.pl & >> gene1-terminal_out.txt but it doesn't work. Again, I would like to be able look at the output on the terminal dynamically as the script is running.

3
  • 1
    what about the at command and/or cron?
    – fuero
    Apr 2, 2013 at 22:24
  • 1
    Tell the admin of the machine to install screen.
    – Sven
    Apr 2, 2013 at 22:24
  • Try it the other way round, run screen on a machine you can control, from there connect to the remote system.
    – ott--
    Apr 2, 2013 at 23:22

1 Answer 1

3

nohup does not have an option to send output to terminal (at least on CentOS)

try this:

bash$ (perl gene1.pl 2>&1 | tee output.log) &

output will be written to terminal AND output.log for later reference.

1
  • 1
    Marcel's answer is great. A variation that I've used is: # perl gene1.pl 2>&1 >> output.log & and then tail -f output.log
    – Stephan
    Apr 2, 2013 at 22:57

Not the answer you're looking for? Browse other questions tagged .