Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Options.
- set HOSTNAME="server.gizmokid2005.com"
- set USERNAME="username"
- set PASSWORD="password"
- set EMAIL="michon1992@gmail.com"
- # End of options. Don't ya dare to touch (and thus break) anything after this ;)
- # Email notification.
- mailto -s "Starting Backup Process" $EMAIL
- # Create the filename.
- set FILENAME=vpsbackup.tgz.`date +%Y%m%d`
- # Backup.
- tar cvpzf $FILENAME --exclude=/$FILENAME --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/bkps --exclude=/cpanel
- # Email notification.
- mailto -s "Backup complete" $EMAIL
- mailto -s "Starting FTP" $EMAIL
- # Connect to FTP.
- ftp -v -n $hostname << EOT >> ftplog
- user $username $password
- binary
- put $filename
- quit
- EOT
- # Read the FTP output from the file.
- set FTPOUTPUT=`less ftplog`
- # Email notification.
- mailto -s "FTP Complete, output:\n\n$FTPOUTPUT" $EMAIL
- # Move backup to bkps folder
- mv $FILENAME /bkps/$FILENAME
- # Delete the ftp output file.
- rm ftplog
- # Email notification.
- mailto -s "Backup Process Complete" $EMAIL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement