Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

closed as off topic by mdpc, Ward, Jenny D, dunxd, Khaled Apr 3 '13 at 14:11

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
what about the at command and/or cron? –  fuero Apr 2 '13 at 22:24
1  
Tell the admin of the machine to install screen. –  SvW Apr 2 '13 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 '13 at 23:22

1 Answer 1

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.

share|improve this answer
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 '13 at 22:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.