Advertisement
Guest User

Untitled

a guest
Jul 28th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.82 KB | None | 0 0
  1. #!/bin/sh
  2. date
  3. echo "############### Backing up files on the system... ###############"
  4.  
  5. backupfilename=server_file_backup_`date '+%Y-%m-%d'`
  6.  
  7. echo "----- First do the sql by deleting the old file and dumping the current data -----"
  8. rm -f /tmp/backup.sql
  9. mysqldump --user=mysqluser --password=password --all-databases --add-drop-table > /tmp/backup.sql
  10.  
  11. echo "----- Now tar, then zip up all files to be saved -----"
  12. tar cvf /directory/to/store/file/${backupfilename}.tar /home/* /var/www/html/* /usr/local/svn/* /etc/php.ini /etc/httpd/conf/httpd.conf /tmp/backup.sql /var/trac/*
  13. gzip /directory/to/store/file/${backupfilename}.tar
  14. rm /directory/to/store/file/${backupfilename}.tar
  15. chmod 666 /directory/to/store/file/${backupfilename}.tar.gz
  16.  
  17. echo "############### Completed backing up system... ###############"
  18. date
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement