Jump to content

How to make backup database ips on ubuntu 18.04_1 in cmd?


Recommended Posts

Hello all. I wrote a script that will make me backup the forum files and database. Database, then it breaks down and you have to do it differently. My script looks like this:

cd /var/www/ && rm -rf backup_forum/*
cd / && rm -rf cmd.tar.gz
cd /var/lib/mysql/ && rm -rf baza_danych.tar.gz
cd /var/www/myforums.pl/ && rm -rf pliki_forum.tar.gz
cd /
tar cfv cmd.tar.gz pack
mv cmd.tar.gz /var/www/backup_forum/
cd /var/lib/mysql/
tar cfv baza_danych.tar.gz forum_base
mv baza_danych.tar.gz /var/www/backup_forum/
cd /var/www/myforums.pl/
tar cfv pliki_forum.tar.gz admin api applications datastore oauth plugins system uploads .htaccess 404error.php conf_global.php Credits.txt error.php index.php init.php sitemap.php
mv pliki_forum.tar.gz /var/www/backup_forum/
cd /var/www/backup_forum/
tar cfv backup_forum_$(date +%d.%m.%Y_%H.%M.%S).tar.gz pliki_forum.tar.gz baza_danych.tar.gz cmd.tar.gz
rm -rf baza_danych.tar.gz pliki_forum.tar.gz cmd.tar.gz

After running the script, the database files that were packaged are damaged in the zipped tar.gz archive. How to properly back up the database using the terminal on Ubuntu 18.04_1? The one who will work for me everywhere? 🙂

Link to comment
Share on other sites

It seems you are trying to backup the database directly on the filesystem.  That's not a good idea, as the backup may not get an atomic/consistent view of database (unless you shutdown the service).

Take a look at MySQL/MariaDB documentation for a more reliable backup method for your database version.  (I have been using mysqldump --single-transaction with InnoDB tables, which works fine if the database is not too big.)

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...