Advertisement
AbdulrahmanCode

Untitled

Jun 11th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. #!/bin/bash
  2. ####################################################################
  3. # vBulletin 5.1.9 Patch Level 4 - Licence Number LD125EAAF9
  4. # ---------------------------------------------------------------- #
  5. # Copyright ©2000–2016 vBulletin Solutions Inc. All Rights Reserved.
  6. # This file may not be redistributed in whole or significant part. #
  7. # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- #
  8. # http://www.vbulletin.com | http://www.vbulletin.com/license.html #
  9. ####################################################################
  10.  
  11. # Please change this variable to the path to your config.php
  12. path_to_config="/home/example/htdocs/includes/config.php"
  13.  
  14. # If you need the full path to the mysqldump binaries or gzip binaries set below
  15. mysqldumpcmd=mysqldump
  16. gzipcmd=gzip
  17.  
  18. ################# No Editing below this point #################
  19.  
  20. if [ ! -e "$path_to_config" ]
  21. then
  22. echo "$path_to_config doesn't exist"
  23. exit 1
  24. fi
  25.  
  26. servername=`perl -n -e "if (/MasterServer']\['servername'\]\s*=\s*'(.*)'/) { print \\$1; } else { print ''; }" $path_to_config`
  27. dbusername=`perl -n -e "if (/MasterServer']\['username'\]\s*=\s*'(.*)'/) { print \\$1; } else { print ''; }" $path_to_config`
  28. dbpassword=`perl -n -e "if (/MasterServer']\['password'\]\s*=\s*'(.*)'/) { print \\$1; } else { print ''; }" $path_to_config`
  29. dbname=`perl -n -e "if (/Database']\['dbname'\]\s*=\s*'(.*)'/) { print \\$1; } else { print ''; }" $path_to_config`
  30.  
  31. if [ ! -n "$servername" ]
  32. then
  33. echo "Unable to read server name"
  34. exit 1
  35. fi
  36.  
  37. if [ ! -n "$dbusername" ]
  38. then
  39. echo "Unable to read database user name"
  40. exit 1
  41. fi
  42.  
  43. if [ ! -n "$dbname" ]
  44. then
  45. echo "Unable to read database name"
  46. exit 1
  47. fi
  48.  
  49. date=`date "+%d-%m-%y"`
  50. database="${dbname}-${date}.sql"
  51.  
  52. case "$1" in
  53. backup)
  54. if [ -n "$dbpassword" ]
  55. then
  56. passwordinfo=-p$dbpassword
  57. fi
  58. $mysqldumpcmd -h$servername -u$dbusername $passwordinfo --add-drop-table --add-locks --all --extended-insert --quick --compress $dbname > $database
  59. $gzipcmd $database
  60. ;;
  61.  
  62. *)
  63. echo "vb_backup.sh: Database backup script for vBulletin 3."
  64. echo "Please use the following command to backup your vBulletin database:"
  65. echo "./vb_backup.sh backup"
  66. ;;
  67. esac
  68. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement