LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 08-13-2009, 05:28 AM   #1
cm67
LQ Newbie
 
Registered: Aug 2009
Posts: 3

Rep: Reputation: 0
Batch files to execute and transfer files via sftp


Hi

I have two systems, one running SUSE and the other Red Hat.

On the Red Hat I want to run some scientific code which will dump data into a series of vtk files for viewing later in Paraview, but that system does not have Paraview installed nor does it have a graphics card.

The SUSE system has Paraview installed.

What I want to know is, can I create a batch file or something similar that will
1. run the scientific code on the Red Hat system
2. when the scientific code has finished then tell the Red Hat system to establish a connection to the SUSE system and transfer all the vtk files from the Red Hat to the SUSE and close the connection.

Thanks in advance

Chris
 
Old 08-13-2009, 05:34 AM   #2
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 47
Yes.
The first thing to do is enable public key authentication in ssh. This will allow unattended logins. You can then use ssh to run commands on the remote machine.
You can also use sftp in scripted mode to receive back files.
 
Old 08-13-2009, 05:55 AM   #3
cm67
LQ Newbie
 
Registered: Aug 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks Nowonmai, but could you go into a bit more detail please?

For example could you give an outline of the batch file structure with commands and parameters?
 
Old 08-13-2009, 06:50 AM   #4
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 47
Code:
ssh user@host "command"

sftp -b control_file user@host
The control file would contain the sftp commands, such as get x.y or whatever.
 
Old 08-13-2009, 06:56 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,344

Rep: Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945
I would probably use scp instead of sftp there.
 
Old 08-13-2009, 09:59 AM   #6
cm67
LQ Newbie
 
Registered: Aug 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Thumbs up Thanks

thanks to both of you. I'll try both of these.

 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Transfer files securely with SFTP LXer Syndicated Linux News 0 06-01-2007 05:31 PM
Batch files spotslayer Linux - Software 3 06-18-2004 07:31 PM
Files truncated by sftp/sftp-server at 65kb gato Linux - Networking 1 12-18-2003 10:29 AM
"batch files" in red hat, similar to .bat files in dos shycalais Linux - Newbie 2 10-12-2003 08:34 AM
Can log files be time stamped? (such as FTP login and transfer log files) bripage Linux - Networking 6 08-08-2002 10:55 PM


All times are GMT -5. The time now is 01:31 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration