Automating server backup downloads

The first thing needed is the ftp script:

ftp -in << SCRIPTEND
user [email protected] ftppassword
cd /backups
mget filename.tar.bz2

The next one is the email alert that is sent automatically when the task is over:

$cat alertmail
echo "This is the server at Your file has been downloaded!" | mail -s "FTP task done" "[email protected]"[


The next is a script that invokes nohup to prevent the task from terminating when the shell terminates:

cat dontcancel
nohup $1

An ampersand may be inserted at the end to keep the process in the background.

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.