Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.


Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.


Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.


Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Commands & Shells

Run Background Tasks via SSH

Submitted by on June 16, 2011 – 12:58 am 2 Comments

The idea here is simple: you need to connect to hosts 1..100 and execute a command in the background. The trick is to make sure the command continues to run after the SSH session terminates. Simply adding the “&” at the end of the command is not the answer here. In the example below we run a loop that connects to hosts node1 through node100 and executes an rsync process in the background, which continues to run even after the SSH session ends.

while [ $i -le 100 ]
     echo "Launching rsync on node${i}"
     ssh node${i} "nohup rsync -avu /source_dir /target_dir /dev/null 2>&1 &"
     (( i = i + 1 ))

We are using the “nohup” command to create a session-independent process and we redirect all stdout and stderr to /dev/null. The script will connect to the first node; start the rsync process in the background; then it will disconnect and move on to the next node, leaving the rsync process running.

Print Friendly, PDF & Email


  • EzioAuditore1459 says:

    I’m doing a little research into protocols and networks.

    So for example if I have a network with Microsoft Windows computers, and Apple Mac computers, what would be the protocols I would need to link these 2 together?

    At the moment I have got AppleTalk as the main protocol suite as it can be installed on Windows computers as well at Apple computers. I also know that AFP (AppleTalk Filing Protocol) is in the AppleTalk suite and is for file transfers.

    Thanks in advance!

  • rndmaktn says:

    Basiclly a port proxy thats fast

1 Pingbacks »

Leave a Reply

%d bloggers like this: