0

Do you know a Debian apt-available software to make dir and database immediate backups of a webserver webapps?

An option to exclude some sub directories should be a feature.

Something that works quite like this (note the date variables and cache dir exclude):

cat <<-"IMMEDIATE_BACKUP" > /opt/backup.sh
    zip -r /var/www/html/html-$(date +\%F-\%T).zip /var/www/html -x "*wp-content/cache*"

    mysqldump -u root -p --all-databases > /var/www/html/db-$(date +\%F-\%T).sql
    zip /var/www/html/db-$(date +\%F-\%T).zip /var/www/html/db-*.sql
    rm /var/www/html/db-*.sql

    zip -r /var/www/html/html-$(date +\%F-\%T).zip /db-$(date +\%F-\%T).zip /var/www/html/all_zipped.zip

    rm db-$(date +\%F-\%T).zip
    rm html-$(date +\%F-\%T).zip
IMMEDIATE_BACKUP
chmod +x /opt/backup.sh
  • So what do you dislike with your approach? Looks like it should work. Though I do it slightly different: putting the files into a version control system (so one has only to "commit with including all new files"), and dumping each database separately (by looping over the output of show databases). The latter I find important as it permits me to easily restore a single application without affecting the others. – Izzy Jan 11 '18 at 7:53
  • The above script is fine indeed, it's just that I would prefer to work with a tool which is in the Debian repositories as my Nginx script files are very long and filled with scripts already and I don't have the spare time to maintain all the data in that time in my life. – Arcticooling Jan 11 '18 at 8:18
  • 2
    Understood. Just keep in mind a tool in the repos today might be missing tomorrow – when your shell scripts would still work fine. My related scripts do so for at least 10 years now, while I've rarely touched them. But YMMW, so your question is perfectly OK – I just wanted to 1) figure what you might expect being better with the software you're asking for (which you gave reason to), and 2) pointing out an approach in case you don't find anything suiting :) – Izzy Jan 11 '18 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.