Advertisement
Guest User

Untitled

a guest
Sep 12th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Bins
  4. MYSQLDUMP=`which mysqldump`
  5. GZIP=`which gzip`
  6. NCFTP=`which ncftp`
  7.  
  8. # Date for folders and filenames
  9. DAY=$(date +"%Y-%m-%d")
  10. FILETIME=$(date +"%Y-%m-%d.%T")
  11.  
  12. # Local backup folder (no trailing slash)
  13. LOCAL_FOLDER="/tmp/backup"
  14.  
  15. # FTP Configuration
  16. REMOTE_HOST="x.x.x.x"
  17. REMOTE_USER="ftp_user"
  18. REMOTE_PASS="ftp_pass"
  19. REMOTE_FOLDER="/" # With trailing slash
  20.  
  21. # Prikaz pro zalohu
  22.  
  23.  
  24. # Transfer all backup files to remote host
  25. echo -e "033[32mnTransfering files!033[0m"
  26. $NCFTP -u$REMOTE_USER -p$REMOTE_PASS $REMOTE_HOST<<EOF
  27. mkdir $REMOTE_FOLDER$DAY
  28. cd $REMOTE_FOLDER$DAY
  29. lcd $LOCAL_FOLDER
  30. mput *
  31. quit
  32. EOF
  33.  
  34. # Delete local dump files
  35. rm -f $LOCAL_FOLDER/*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement