You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-12Lines changed: 26 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,9 @@
28
28
-**Remote Uploads:**
29
29
Optionally upload backups to a remote server using SFTP, FTP, or SCP with configurable scheduling (daily, first day, last day, specific weekday, or a numeric day of the month).
30
30
31
+
-**Wildcard Support for Ignored Databases:**
32
+
Use wildcard patterns (e.g., `projekti_*`) in `ignored_databases` to skip databases by name pattern.
33
+
31
34
-**Modular & Maintainable:**
32
35
Code is organized into multiple modules (configuration, backup logic, notifications, remote upload) for easier maintenance and extensibility.
33
36
@@ -49,14 +52,16 @@
49
52
50
53
### Prerequisites
51
54
52
-
-**Python 3.6+** is required.
53
-
- Install the necessary Python packages using pip:
54
-
```bash
55
-
pip install requests paramiko twilio
56
-
```
57
-
-`requests`: For HTTP requests (used in notifications and remote uploads).
58
-
-`paramiko`: For SFTP uploads.
59
-
-`twilio`: For sending SMS notifications.
55
+
1.**Python 3.6+** is required.
56
+
2.**MySQL or MariaDB** client tools installed (e.g., `mysql`, `mysqldump`).
57
+
3. Install the necessary Python packages using `pip`:
58
+
```bash
59
+
pip install requests paramiko twilio fnmatch
60
+
```
61
+
-`requests`: For HTTP requests (used in notifications and remote uploads).
-**Important:** Do not modify `config.ini.default` directly. Instead, copy it to create your local configuration file:
88
+
3.**Configuration File Setup:**
89
+
-**Important:** Do not modify `config.ini.default` directly. Instead, copy it:
85
90
```bash
86
91
cp config.ini.default config.ini
87
92
```
88
93
- Open `config.ini` and adjust the settings to match your environment (e.g., MySQL credentials, notification channel settings, remote upload settings, etc.).
89
94
95
+
>**Note:** If you pull new changes from this repo in the future, your local`config.ini` will remain untouched, preserving your production settings.
96
+
97
+
4. **(Optional) Unit Tests:**
98
+
- If you want to run the included unit tests (if any), install `unittest` (bundled with Python), plus any additional test dependencies, and run:
99
+
```bash
100
+
python3 -m unittest discover
101
+
```
102
+
90
103
## Configuration Tutorial
91
104
92
105
The `config.ini` file is the central configuration file for**sqlBackup**. It is divided into several sections:
@@ -101,6 +114,7 @@ The `config.ini` file is the central configuration file for **sqlBackup**. It is
101
114
- **mysql_path:** Path to the MySQL client.
102
115
- **mysqldump_path:** Path to the mysqldump utility.
103
116
- **ignored_databases:** Comma-separated list of databases to skip.
117
+
- **Now supports wildcards:** e.g. `sys, mysql, projekti_*`. Any database name matching `projekti_*` will be ignored (e.g., `projekti_alpha`, `projekti_1`).
104
118
105
119
### [telegram]
106
120
- **enabled:** Enable or disable Telegram notifications.
@@ -142,7 +156,7 @@ The `config.ini` file is the central configuration file for **sqlBackup**. It is
142
156
### [export]
143
157
- **include_routines:** Include stored procedures and functions.
144
158
- **include_events:** Include scheduled events.
145
-
- **column_statistics:** If set to false, the script will add `--column-statistics=0` to the dump command.
159
+
- **column_statistics:** If set to false, the script adds `--column-statistics=0` to the dump command (helpful for older servers).
146
160
147
161
### [remote]
148
162
- **upload_enabled:** Enable or disable remote upload of backups.
@@ -162,7 +176,7 @@ python3 main.py
162
176
```
163
177
164
178
The script will:
165
-
- Connect to MySQL and dump databases (skipping those in`ignored_databases`).
179
+
- Connect to MySQL and dump databases (skipping those in`ignored_databases`, including wildcards).
166
180
- Archive each dump according to the specified format.
167
181
- Display a summary table with database name, backup status, elapsed time, dump size, and archive size.
0 commit comments