Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2002-06-27
2
Medium Priority
?
215 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 800 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month11 days, 19 hours left to enroll

916 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