Operating System - HP-UX
1748111 Members
3522 Online
108758 Solutions
New Discussion юеВ

Script for running FTP in the background

 
Sandip Ghosh
Honored Contributor

Script for running FTP in the background

Hi,

I want to run FTP in the background from one unix box to other unix box.

Does any one have any kind of scricpt for the above purpose?

Many many thanks in advance.

Sandip
Good Luck!!!
20 REPLIES 20
LucianoCarvalho
Respected Contributor

Re: Script for running FTP in the background

Here it is.

#!/bin/sh





ftp -i -n -v <<-ftpend


open maquina_remota


user Nome_do_Usuario password


binary


cd /diretorio_remoto


lcd /diretorio_local


get arquivo_remoto


put arquivo_local


quit


ftpend
LucianoCarvalho
Respected Contributor

Re: Script for running FTP in the background

#!/bin/sh





ftp -i -n -v <<-ftpend


open remote machine


user user-name password


binary


cd /remote-directory


lcd /local-directory


get remote file


put put local file


quit


ftpend
John Poff
Honored Contributor

Re: Script for running FTP in the background

Hi,

Here is a thread that give a couple of good examples, especially the Perl script:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xadc85a3e6e0bd6118ff40090279cd0f9,00.html

JP
Mark Greene_1
Honored Contributor

Re: Script for running FTP in the background

If what is getting moved and where it is going are static, you can create a .netrc file with the ftp commands, and then simply cron an ftp to the server which will run the macro in the .netrc file. You can, in the crontab, do the usual redirection of standard out and error to a log file for later diagnosis, if needed. See the man page on netrc for syntax and further explanation.

mark
the future will be a lot like now, only later
Steven E. Protter
Exalted Contributor

Re: Script for running FTP in the background

A different kind of answer.

snarf

It runs ftp jobs, can be scripted easily.

Here is a link.

http://hpux.cs.utah.edu/hppd/hpux/Networking/FTP/snarf-7.0/

"Attaching snarfscript my little job for running snarf to snarf up those files from me.

snarf.

The sysadmins friend.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sandip Ghosh
Honored Contributor

Re: Script for running FTP in the background

Thanks to all for your replies.

We are already having scripts for FTP and those are running fine. But when we are trying to run that in background it is giving stty:I/O error.

That is why I was looking for a script that can be run in the background.

Sandip
Good Luck!!!
Shannon Petry
Honored Contributor

Re: Script for running FTP in the background

Okay, if your scripts already work, they should work from the background as well as the foreground unless something in the script is broken.

I.E. Can you run the script from at or cron?

If so, then your okay to run

my_ftpscript.sh &

If it does not, then something is wrong. Misplaced/missing #!/bin/ksh perhaps, hard to say without your script to view.

Regards,
Shannon
Microsoft. When do you want a virus today?
Rodney Hills
Honored Contributor

Re: Script for running FTP in the background

stty error. Sounds like you are running .profile or equivalent.

If you are running the job from "cron", then it won't run the .profile automatically. If you do a "su - username" in the script, that would run .profile.

HTH

-- Rod Hills
There be dragons...
Yogeeraj_1
Honored Contributor

Re: Script for running FTP in the background

hi,

can you try to cron a script with commands similar to below? [as root??]

su - ftpuser1 -c "$SCRIPT_HOME/myftp.sh"

hope this helps!

regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)