Advertisement
hjaltiatla

Restoring a Filesystem backup Using a Tarsnap backup

Nov 8th, 2019
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.70 KB | None | 0 0
  1. --Restoring a Filesystem backup Using a Tarsnap backup--
  2.  
  3. #1.Check tarsnap to find the archive you want
  4. tarsnap --list-archives | sort
  5.  
  6. #2. Download from tarsnap
  7. tarsnap -x -f 2019-11-07-hostedsites
  8.  
  9. #3 unzip
  10. tar zxf backupname.tar.gz
  11.  
  12. #4 Rename original directory and replace with backup
  13. #a) mv /home/username/public_html /home/username/pub_hack
  14. #b) mv tarsnapdir/public_html /home/username/public_html
  15.  
  16. #5 Reload nginx.
  17. systemctl reload nginx
  18.  
  19. --Restoring a Database Backup--
  20. #To restore a single database:
  21. mysql -u root -p [database_name] < backupname.sql
  22.  
  23. #To restore all databases (tables need to exist, or backup needs to contain CREATE TABLE statements):
  24. mysql -u root -p < alldatabases.sql
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement