ftp and running a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ftp and running a script
# 1  
Old 10-15-2010
ftp and running a script

Hi,

I want to write a script that can connect from server A to server B .. so i need the following

1. sftp to server B
2. pull some files out from server B using an existing script in server A

Can I do that?

Thanks
# 2  
Old 10-15-2010
Simple!

You will need keys so there is no password prompt, or something like expect to run under a pseudo-terminal to allow writing pasword as /dev/tty.

You might as well use scp, and save all the complex dialog.

Consider trying compression to speed transfer and save net bandwidth.
# 3  
Old 10-15-2010
I am not sure if I understood your question, but you can do it using SCP/SFTP and SSH:
Code:
# Execute SCP/SFTP to retreive files
scp <user>@<host>:<remote file/pattern> <local directory>
# Execute SSH to do something in the remote host
echo "<your script here>" | ssh -C -l <user> <host>

# 4  
Old 10-15-2010
PS: scp also has an arg to force checking the target to be a dir, in case it is missing, so the first does not become a dir-named-flat-file and the rest overwrite it.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

running a script in a ftp session

Hi guys, I am using a script that run ftp and transfer file from my source server to the destination server. Since i have transferred my files to the destination server, now i want to run a script at the destination server. Could you please help me regarding how to run a script in a ftp... (7 Replies)
Discussion started by: jaituteja
7 Replies

2. Shell Programming and Scripting

ftp script is not running from CRON

Hi I have an FTP script, which ftp's the files from one unix box to another box. It works from the command when I Issue > ksh ftp.ksh when I schedule it in CRON, it is not being executed automatically. Any thoughts please Thanks Ravi. (4 Replies)
Discussion started by: ravi.balley
4 Replies

3. Shell Programming and Scripting

Automated FTP script using .netrc to multiple FTP servers

Hi all, I'm using the following script to automated ftp files to 1 ftp servers host=192.168.0.1 /usr/bin/ftp -vi >> $bkplog 2>&1 <<ftp open $host bin cd ${directory} put $files quit ftp and the .netrc file contain machine 192.168.0.1 login abc... (4 Replies)
Discussion started by: varu0612
4 Replies

4. Shell Programming and Scripting

passing parameter to ftp script from output of another ftp

Hi, I have a ftp script which first gets all the file names and echo's the latest file. I'm using another ftp command sets to get the file name given by first ftp. The problem is the parameter is not accepted by second ftp. The error message i'm getting is > Rename Temp File calloc:ICMP... (5 Replies)
Discussion started by: ammu
5 Replies

5. Shell Programming and Scripting

running script in ftp session

Dear Friends, I have this script CAP2_Launcher on suntest server. this script needs two input files in order to process them and produces an output files. I've created .bat file from windows to access the server and transfer the input files needed by the script and execute the script then pull... (3 Replies)
Discussion started by: sfaqih
3 Replies

6. Shell Programming and Scripting

Running a script for every ftp session

Hello all, I have written a shell script which would prompt the user to enter some name and a folder would be created by that name. This script should run automatically when the users provide there credentials during a FTP session and for every FTP session. And after they have provided there... (5 Replies)
Discussion started by: h3llh0l3
5 Replies

7. Shell Programming and Scripting

KSH, FTP running a set number at a time?

At work we have a script that pulls a file from a list of remote sites every 10 min. Currently it only does this ftp one sites at a time and this process takes up to 8 minutes to complete. I want to have this list of 24 sites and be able to run the ftp from up to 2 sites on the list at a time. I... (1 Reply)
Discussion started by: kofs79
1 Replies

8. UNIX for Dummies Questions & Answers

FTP from PC to VM running RHEL5 / RHEL4

Hi, I am setting up virtual machines running Redhat Linux 4 and 5. I would like to be able to ftp files to them from my PC. I can ping ftp rac1.lyl.com fine but when I try to ftp, I get the following but no login prompt... Microsoft Windows XP (C) Copyright 1985-2001 Microsoft Corp. ... (4 Replies)
Discussion started by: CuriousKitty
4 Replies

9. Shell Programming and Scripting

FTP script to FTP file to UNIX - Solaris

Hello, A couple of times per week, i receive emails notifications when files are available for processing. Currently i read these eamails with a java program and store the attachement on my C: drive and would now like to generate a PC script to send this file name up to UNIX-Solaris and... (3 Replies)
Discussion started by: bobk544
3 Replies

10. UNIX for Dummies Questions & Answers

telnet, ftp is running but can't connect from outside

Yesterday, I and all my users couldn't connect to my server using ssh, telnet or ftp even though they were running (keep getting "connection timed out" error message). This morning, my partner logon from the main console, restarted sshd and xinetd (I belive he didnt restarted the server), now I... (0 Replies)
Discussion started by: Micz
0 Replies
Login or Register to Ask a Question