Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is the situation:

  • I am running a VPN so I can connect to several computers at my faculty
  • I have several tasks that I want to run in parallel(these will be intensive and seperate tasks(classification on large datasets) that can be done on these computers overnight)
  • I have a BASH script to copy the appropriate files to the right computers and start the scripts on these computers that in turn activate the tasks.
  • I use ssh to connect to the computers
  • it works great if I connect to the computers consecutively
  • however if I run the ssh commands in parallel(using a bash function and the & operator 'run $variables &') it seems to start okay but then I get these errors:

Connection to closed by remote host. lost connection

After this, my VPN stops working and I have to reconnect.

So is there anything I can do about this? If I run it on two machines it's okay, three as well, but for four machines it sometimes works and sometimes it doesn't.

Do you need any more information? and is it this the right site to ask it on?

Further information:

  • I'm an ADSL line, the university internet connection should be great(where I'm connecting to)
  • I use a cisco VPN client to connect to the university network(with enabled transparent tunneling IPSec over TCP, group authentication)
  • I connect from a ubuntu virtual machine running on my home pc with fedora remote pc's at the university
  • I can't open sshd_config at the remote machines
  • the bandwith should really be okay, but perhaps the home router I'm behind(haven't got access to it) might be interfering?

Perhaps there would be a way to send the ssh commands and then disconnect before sending the next command(so without waiting for the command sent over ssh to finish), would it work to set up a script on the remote host that starts the task that doesn't wait for it to finish, or do all bash script wait for the issued commands to finish?

I'm not an experienced network user or linux user

share|improve this question
Could you provide some more detail about the devices used to establish the VPN connection and the kind of connection bandwidth etc involved. – wolfgangsz Jul 7 '11 at 22:54
I updated the question, hope it helps.. – ate_f Jul 8 '11 at 9:19

This looks like your SSH connections are timing out, presumably because these scripts are running for a long time without providing any output or feedback (as this would keep the tunnel alive).

Maybe you should try to automate this more, i.e. use rsync or scp from a cron job to transfer the relevant files at specific times and then use cron jobs on the remote servers to process them. The remote cron jobs could collect their output in files and then send you a summary via email.

If you were able to modify the sshd_config on the remote machines (which you say you aren't, so this is hypothetical), you might be able to extend the timeout period or use TCP keepalive instead.

share|improve this answer
Thanks for the hints, I will investigate it further. Setting up a cron job to run everything is a good idea as it will limit me to using scp. However, if it was a timeout, why would it work I process each task by itself? The tasks gets spread over the machines, and I don't have any problems if I just run the tasks sequentially instead of in parallel. – ate_f Jul 8 '11 at 10:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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