https://github.com/spithash/linux-backup-script
Take backups of your mysql/mariadb databases and your files/folders. This bash script can be useful for linux server backups or migrations.
https://github.com/spithash/linux-backup-script
backup backup-script bash-script database linux linux-backup mariadb-database mysql-database
Last synced: 8 months ago
JSON representation
Take backups of your mysql/mariadb databases and your files/folders. This bash script can be useful for linux server backups or migrations.
- Host: GitHub
- URL: https://github.com/spithash/linux-backup-script
- Owner: spithash
- License: gpl-3.0
- Created: 2022-04-29T09:36:24.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-04T13:28:21.000Z (over 1 year ago)
- Last Synced: 2025-04-30T11:58:55.537Z (10 months ago)
- Topics: backup, backup-script, bash-script, database, linux, linux-backup, mariadb-database, mysql-database
- Language: Shell
- Homepage:
- Size: 38.1 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Linux Backup Script (Bash)
Take backups of your mysql/mariadb databases and your files/folders. This can be useful for server backups or migrations.
I personaly use it to backup all of /etc/ and maybe home user directories including websites and databases that I maintain.
Makes my life easier not having to go through all the progress again and again. I just change the folder paths to the ones I need and I'm ready to go.
The script will use gzip to create .gz archives of your files.
# Requirements
Packages **pv & gzip** are required to be installed on your system because they're needed for the progress bar and archive creation of your files and .sql databases.
Use your favourite package manager and install them.
On Debian this should do: **sudo apt install pv gzip**
Also, **sudo** is required. We need it so we can backup system files.
# MySQL/MariaDB
The script will ask for mysql user and password confirmation each time you dump a database.
If this bothers you, then you should create a .my.cnf file (see below) and **also** you should remove "-u root -p" from the mysql commands to avoid trying to connect as root ***if you don't have to***.
## .my.cnf – mysql user & password
Create file ~/.my.cnf and add following lines in it and replace mysqluser & mysqlpass values.
```
[client]
user=mysqluser
password=mysqlpass
```
For safety, make this file readable to you only by running chmod 0600 ~/.my.cnf
# Usage
Just run it with: **sudo bash fullsysbackup.sh**
# TODO:
* Make it work with dialog for a fancy progress bar.
* Maybe use rsync to copy files to a remote machine?