The first thing needed is the ftp script:
#!/bin/bash ftp -in ftp.hostname.com << SCRIPTEND user [email protected] ftppassword binary cd /backups mget filename.tar.bz2 SCRIPTEND ./alertmail
The next one is the email alert that is sent automatically when the task is over:
$cat alertmail #!/bin/bash echo "This is the server at joel.co.in. 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 #!/bin/bash nohup $1
An ampersand may be inserted at the end to keep the process in the background.
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.