Skip to content

Instantly share code, notes, and snippets.

@Neolot
Created December 21, 2015 13:29
Show Gist options
  • Save Neolot/5224a5e0588634820436 to your computer and use it in GitHub Desktop.
Save Neolot/5224a5e0588634820436 to your computer and use it in GitHub Desktop.
Full backup site for linux
#!/bin/sh
now=$(date +"%d%m%y")
backupdir=/usr/backup/$now
mkdir $backupdir
mkdir $backupdir/db
tar -czvf $backupdir/files.tar.gz /var/www
dbuser='XXX'
dbpw='YYY'
mysqldump -u $dbuser -p$dbpw ZZZ | gzip > $backupdir/db/ZZZ.sql.gz
find /usr/backup -type d -mtime +6 -exec rm -rf {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment