LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-20-2004, 04:33 AM   #1
pantera
Member
 
Registered: May 2004
Posts: 80

Rep: Reputation: 15
ssh


how to use ssh in a shell script to do parallel processing a file using more than 2 pcs.
for example how to make a loop from 1 to 100 run in two different pcs so that one runs form 1 to 50 and another pc runs 51 to 100
 
Old 05-20-2004, 07:36 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
The simple way:

First arrange for ssh's public key authentication on the remote machines so you do not need to enter passwords when invoking ssh.

The something like:
Code:
#!/bin/bash
echo >/tmp/script1 <<EOF
for i in $(seq 1 50) ; do
    <process your things>
done
EOF

echo >/tmp/script2 <<EOF
for i in $(seq 51 100) ; do
    <process your things>
done
EOF

scp /tmp/script1 username@host1:~/
scp /tmp/script2 username@host2:~/

ssh username@host1 /home/username/script1
ssh username@host2 /home/username/script2

Last edited by Hko; 05-20-2004 at 07:38 AM.
 
Old 05-20-2004, 08:28 AM   #3
pantera
Member
 
Registered: May 2004
Posts: 80

Original Poster
Rep: Reputation: 15
thanx for the help

how can we pass a value from one script file to another ??
 
Old 05-20-2004, 09:02 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Read the answer in the other thread where you asked this.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
[SSH] Issue logging in [SSH & Permissions] MD3 Linux - Networking 11 12-10-2006 09:25 AM
Mac OS X ssh client / linux sshd : ssh hangs/disconnects Apollo77 Linux - Networking 1 05-24-2006 11:53 AM
I turned off SSH, but I cant get it back! How do you start SSH on boot? nmoog Slackware 2 02-08-2004 05:18 PM
ssh issue: /usr/bin/ssh -x -oFallBackToRsh no -l WeNdeL Linux - Software 1 03-04-2003 07:17 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration