michalsky394 Posted November 4, 2018 Share Posted November 4, 2018 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: #!/bin/sh clear 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 More sharing options...
michalsky394 Posted November 4, 2018 Author Share Posted November 4, 2018 Problem has been solved. Â Link to comment Share on other sites More sharing options...
ptprog Posted November 5, 2018 Share Posted November 5, 2018 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.