Advertisement
Guest User

Untitled

a guest
May 9th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ###############################################
  4. # CHANGE THESE OPTIONS TO MATCH YOUR SYSTEM ! #
  5. ###############################################
  6.  
  7. cfgfile=/usr/local/www/ampache/config/ampache.cfg.php # Ampache config file
  8. ampachedir=/usr/local/www/ampache # the directory Ampache is installed in
  9. backupdir=/home/jamie/ampache_backup # the directory to write the backup to
  10.  
  11. ###############################################
  12. # END OF CONFIGURABLE OPTIONS #
  13. ###############################################
  14.  
  15. #ampacheDBserver=`grep "^database_hostname" $cfgfile | cut --delimiter="=" -f2 | cut --delimiter="\"" -f2`
  16. #ampacheDB=`grep "database_name" $cfgfile | cut --delimiter="=" -f2 | cut --delimiter="\"" -f2`
  17. #ampacheDBuser=`grep "database_username" $cfgfile | cut --delimiter="=" -f2 | cut --delimiter="\"" -f2`
  18. #ampacheDBpassword=`grep database_password $cfgfile | cut --delimiter="=" -f2 | cut --delimiter="\"" -f2`
  19.  
  20. mysqlopt="--host=localhost --user=ampache --password=llamasex"
  21.  
  22. timestamp=`date +%Y-%m-%d`
  23.  
  24. dbdump="$backupdir/ampache-$timestamp.sql.gz"
  25. filedump="$backupdir/ampache-$timestamp.files.tgz"
  26.  
  27. date
  28. echo "Ampache backup."
  29. echo "Database: $ampacheDB"
  30. echo "Login: $ampacheDBuser / $ampacheDBpassword"
  31. echo "Directory: $ampachedir"
  32. echo "Backup to: $backupdir"
  33. echo
  34. echo "creating database dump..."
  35. mysqldump --default-character-set=utf8 $mysqlopt "ampache" | gzip > "$dbdump" || exit $?
  36.  
  37. echo "creating file archive of $ampachedir ..."
  38. cd "$ampachedir"
  39. tar --exclude .svn -zcf "$filedump" . || exit $?
  40.  
  41. echo "Done!"
  42. echo "Backup files:"
  43. ls -l $dbdump
  44. ls -l $filedump
  45. echo "******************************************"
  46. echo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement