Skip to content

Instantly share code, notes, and snippets.

@abdulhadad
Last active March 27, 2017 05:06
Show Gist options
  • Select an option

  • Save abdulhadad/92f8358cf2634f62b3ea76424353796c to your computer and use it in GitHub Desktop.

Select an option

Save abdulhadad/92f8358cf2634f62b3ea76424353796c to your computer and use it in GitHub Desktop.
Backup or sanpshot yout apache php application
[client]
password=your_pass
#!/bin/sh
# backup lamp application on ubuntu
DATE=$(date +%Y%m%d-%H%M)
APP=app_name
DIRS="dir1 dir2"
DBS="db1 db2"
tar -cvJf $APP-$DATE.txz -C /var/www/html $DIRS
mysqldump --defaults-file=./backup.ini -uroot --databases $DBS | xz > $APP-$DATE.sql.xz
tar -cvf backup.tar $APP-$DATE.txz $APP-$DATE.sql.xz
rm -f $APP-$DATE.txz $APP-$DATE.sql.xz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment