Advertisement
Guest User

Untitled

a guest
May 1st, 2017
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.04 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Options.
  4. set HOSTNAME="server.gizmokid2005.com"
  5. set USERNAME="username"
  6. set PASSWORD="password"
  7. set EMAIL="michon1992@gmail.com"
  8. # End of options. Don't ya dare to touch (and thus break) anything after this ;)
  9.  
  10. # Email notification.
  11. mailto -s "Starting Backup Process" $EMAIL
  12.  
  13. # Create the filename.
  14. set FILENAME=vpsbackup.tgz.`date +%Y%m%d`
  15.  
  16. # Backup.
  17. tar cvpzf $FILENAME --exclude=/$FILENAME --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/bkps --exclude=/cpanel
  18.  
  19. # Email notification.
  20. mailto -s "Backup complete" $EMAIL
  21. mailto -s "Starting FTP" $EMAIL
  22.  
  23. # Connect to FTP.
  24. ftp -v -n $hostname << EOT >> ftplog
  25. user $username $password
  26. binary
  27. put $filename
  28. quit
  29. EOT
  30.  
  31. # Read the FTP output from the file.
  32. set FTPOUTPUT=`less ftplog`
  33.  
  34. # Email notification.
  35. mailto -s "FTP Complete, output:\n\n$FTPOUTPUT" $EMAIL
  36.  
  37. # Move backup to bkps folder
  38. mv $FILENAME /bkps/$FILENAME
  39.  
  40. # Delete the ftp output file.
  41. rm ftplog
  42.  
  43. # Email notification.
  44. mailto -s "Backup Process Complete" $EMAIL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement