Skip to content

Commit 193d46b

Browse files
authored
Merge pull request #15 from jkaninda/develop
Change Default cronjob time
2 parents d1cbe8b + b81c6fc commit 193d46b

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ MySQL Backup tool, backup database to S3 or Object Storage
3434
| --dbname | -d | Set database name |
3535
| --port | -p | Set database port (default: 3306) |
3636
| --mode | -m | Set execution mode. default or scheduled (default: default) |
37-
| --period | | Set crontab period for scheduled mode only. (default: "*/30 * * * *") |
37+
| --period | | Set crontab period for scheduled mode only. (default: "0 1 * * *") |
3838
| --timeout | -t | Set timeout (default: 60s) |
3939
| --help | -h | Print this help message and exit |
4040
| --version | -V | Print version information and exit |
@@ -185,7 +185,7 @@ services:
185185
## Run in Scheduled mode
186186

187187
This tool can be run as CronJob in Kubernetes for a regular backup which makes deployment on Kubernetes easy as Kubernetes has CronJob resources.
188-
For Docker, you need to run it in scheduled mode by adding `--mode scheduled` flag and specify the periodical backup time by adding `--period "*/30 * * * *"` flag.
188+
For Docker, you need to run it in scheduled mode by adding `--mode scheduled` flag and specify the periodical backup time by adding `--period "0 1 * * *"` flag.
189189

190190
Make an automated backup on Docker
191191

@@ -215,12 +215,28 @@ Easy to remember format:
215215
------------- Minute (0 - 59)
216216
```
217217

218+
> At every 30th minute
219+
220+
```conf
221+
*/30 * * * *
222+
```
223+
> “At minute 0.” every hour
224+
```conf
225+
0 * * * *
226+
```
227+
228+
> “At 01:00.” every day
229+
230+
```conf
231+
0 1 * * *
232+
```
233+
218234
## Example of scheduled mode
219235

220236
> Docker run :
221237
222238
```sh
223-
docker run --rm --name mysql-bkup -v $BACKUP_DIR:/backup/ -e "DB_HOST=$DB_HOST" -e "DB_USERNAME=$DB_USERNAME" -e "DB_PASSWORD=$DB_PASSWORD" jkaninda/mysql-bkup:latest bkup --operation backup --dbname $DB_NAME --mode scheduled --period "*/30 * * * *"
239+
docker run --rm --name mysql-bkup -v $BACKUP_DIR:/backup/ -e "DB_HOST=$DB_HOST" -e "DB_USERNAME=$DB_USERNAME" -e "DB_PASSWORD=$DB_PASSWORD" jkaninda/mysql-bkup:latest bkup --operation backup --dbname $DB_NAME --mode scheduled --period "0 1 * * *"
224240
```
225241

226242
> With Docker compose

src/mysql_bkup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export STORAGE_PATH=/backup
1010
export S3_PATH=/mysql-bkup
1111
export TIMEOUT=60
1212
export EXECUTION_MODE="default"
13-
export SCHEDULE_PERIOD="*/30 * * * *"
13+
export SCHEDULE_PERIOD="0 1 * * *"
1414
export FILE_COMPRESION=true
1515
usage_info()
1616
{
@@ -48,7 +48,7 @@ help()
4848
echo " -d |--dbname -- Set database name "
4949
echo " -p |--port -- Set database port (default: 3306)"
5050
echo " -m |--mode -- Set execution mode (default: default)"
51-
echo " |--period -- Set schedule period time (default: '*/30 * * *')"
51+
echo " |--period -- Set schedule period time (default: '0 1 * * *')"
5252
echo " -t |--timeout -- Set timeout (default: 120s)"
5353
echo " -h |--help -- Print this help message and exit"
5454
echo " -V |--version -- Print version information and exit"

0 commit comments

Comments
 (0)