Solved

script to FTP a file to another server - making backup of the current one first

Posted on 2002-06-27
2
207 Views
Last Modified: 2013-12-15
I need a script that will FTP a file to another UNIX server.  In addition to this I will need to have the file that is about to be over written to be copied to a timestamped backup.

Any suggestions/examples on how to accomplish this?

Thanks,

Lisa
0
Comment
Question by:lphillips120898
2 Comments
 

Author Comment

by:lphillips120898
ID: 7114226
I posted this in the wrong area... I'm now going to post this in the UNIX section.

Sorry...

Lisa
0
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 200 total points
ID: 7122825
Try this:

#!/bin/ksh

FTP_SITE=111.222.333.444
TODAY=$(date +%Y%m%d)
export FTP_SITE  TODAY

ftp -nv $FTP_SITE <<EOF
user <user_id> <password>
binary (or ascii)
rename <old file> <old file>$TODAY
put <new file>
quit
EOF
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VMWare 6 crashing 14 97
How to clone solaris 10 machine 33 111
Install MySQL 5.6 and PHP on Centos Linux 6 99
shell script or linux command to upload a directory to artifactory? 2 83
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now