0% found this document useful (0 votes)
48 views

Auto FTP

1. The document describes setting up automatic daily backups from a WWW server (120.107.152.251) to a backup server (120.107.152.4) using FTP. 2. It involves creating a .netrc file on the WWW server to store login credentials, writing a shell script to perform daily backups via FTP, and configuring crontab to run the script daily. 3. Basic FTP commands are also listed.

Uploaded by

傅皓皓
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Auto FTP

1. The document describes setting up automatic daily backups from a WWW server (120.107.152.251) to a backup server (120.107.152.4) using FTP. 2. It involves creating a .netrc file on the WWW server to store login credentials, writing a shell script to perform daily backups via FTP, and configuring crontab to run the script daily. 3. Basic FTP commands are also listed.

Uploaded by

傅皓皓
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1. 2.

WWW Server120.107.152.251 (Ubuntu 10.10) Backup Server120.107.152.4 (FreeBSD)

WWW Server Web Pages Backup Server 1. WWW Server (a) .netrc
machine 120.107.152.4 login backup password **********

(b) .netrc
$ chmod 600 .netrc

(c) Backup Sever (120.107.152.4) backup account .netrc (d) shell script FTP
#!/bin/bash # ftp1 cd /home/tkwu/www tar zcf ../www-`date +%d`.tar.gz * ftp -i << backup open 120.107.152.4 bin lcd /home/tkwu/www cd /home/backup put www-`date +%d`.tar.gz quit backup

(e) (d) shell script auto_ftp 700 (f) crontab $ crontab e 0 4 * * 0 auto_ftp

<<Basic FTP Commands>> ? ascii to request help or information about the FTP commands to set the mode of file transfer to ASCII (this is the default and transmits seven bits per character)

to set the mode of file transfer to binary (the binary mode transmits all eight bits per byte and thus binary provides less chance of a transmission error and must be used to transmit files other than ASCII files) bye cd close delete get help lcd ls to exit the FTP environment (same as quit) to change directory on the remote machine to terminate a connection with another computer to delete (remove) a file in the current remote directory (same as rm in UNIX) to copy one file from the remote machine to the local machine to request a list of all available FTP commands to change directory on your local machine (same as UNIX cd) to list the names of the files in the current remote directory to copy multiple files from the remote machine to the local machine; you are prompted for a y/n answer before transferring each file

mkdir to make a new directory within the current remote directory mget

to copy multiple files from the local machine to the remote mput machine; you are prompted for a y/n answer before transferring each file open put pwd quit rmdir to open a connection with another computer to copy one file from the local machine to the remote machine to find out the pathname of the current directory on the remote machine to exit the FTP environment (same as bye) to to remove (delete) a directory in the current remote directory

You might also like