mirror of
https://github.com/jkaninda/mysql-bkup.git
synced 2025-12-06 21:49:40 +01:00
Change Default cronjob time
This commit is contained in:
22
README.md
22
README.md
@@ -34,7 +34,7 @@ MySQL Backup tool, backup database to S3 or Object Storage
|
|||||||
| --dbname | -d | Set database name |
|
| --dbname | -d | Set database name |
|
||||||
| --port | -p | Set database port (default: 3306) |
|
| --port | -p | Set database port (default: 3306) |
|
||||||
| --mode | -m | Set execution mode. default or scheduled (default: default) |
|
| --mode | -m | Set execution mode. default or scheduled (default: default) |
|
||||||
| --period | | Set crontab period for scheduled mode only. (default: "*/30 * * * *") |
|
| --period | | Set crontab period for scheduled mode only. (default: "0 1 * * *") |
|
||||||
| --timeout | -t | Set timeout (default: 60s) |
|
| --timeout | -t | Set timeout (default: 60s) |
|
||||||
| --help | -h | Print this help message and exit |
|
| --help | -h | Print this help message and exit |
|
||||||
| --version | -V | Print version information and exit |
|
| --version | -V | Print version information and exit |
|
||||||
@@ -185,7 +185,7 @@ services:
|
|||||||
## Run in Scheduled mode
|
## Run in Scheduled mode
|
||||||
|
|
||||||
This tool can be run as CronJob in Kubernetes for a regular backup which makes deployment on Kubernetes easy as Kubernetes has CronJob resources.
|
This tool can be run as CronJob in Kubernetes for a regular backup which makes deployment on Kubernetes easy as Kubernetes has CronJob resources.
|
||||||
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.
|
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.
|
||||||
|
|
||||||
Make an automated backup on Docker
|
Make an automated backup on Docker
|
||||||
|
|
||||||
@@ -215,12 +215,28 @@ Easy to remember format:
|
|||||||
------------- Minute (0 - 59)
|
------------- Minute (0 - 59)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> At every 30th minute
|
||||||
|
|
||||||
|
```conf
|
||||||
|
*/30 * * * *
|
||||||
|
```
|
||||||
|
> “At minute 0.” every hour
|
||||||
|
```conf
|
||||||
|
0 * * * *
|
||||||
|
```
|
||||||
|
|
||||||
|
> “At 01:00.” every day
|
||||||
|
|
||||||
|
```conf
|
||||||
|
0 1 * * *
|
||||||
|
```
|
||||||
|
|
||||||
## Example of scheduled mode
|
## Example of scheduled mode
|
||||||
|
|
||||||
> Docker run :
|
> Docker run :
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
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 * * * *"
|
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 * * *"
|
||||||
```
|
```
|
||||||
|
|
||||||
> With Docker compose
|
> With Docker compose
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export STORAGE_PATH=/backup
|
|||||||
export S3_PATH=/mysql-bkup
|
export S3_PATH=/mysql-bkup
|
||||||
export TIMEOUT=60
|
export TIMEOUT=60
|
||||||
export EXECUTION_MODE="default"
|
export EXECUTION_MODE="default"
|
||||||
export SCHEDULE_PERIOD="*/30 * * * *"
|
export SCHEDULE_PERIOD="0 1 * * *"
|
||||||
export FILE_COMPRESION=true
|
export FILE_COMPRESION=true
|
||||||
usage_info()
|
usage_info()
|
||||||
{
|
{
|
||||||
@@ -48,7 +48,7 @@ help()
|
|||||||
echo " -d |--dbname -- Set database name "
|
echo " -d |--dbname -- Set database name "
|
||||||
echo " -p |--port -- Set database port (default: 3306)"
|
echo " -p |--port -- Set database port (default: 3306)"
|
||||||
echo " -m |--mode -- Set execution mode (default: default)"
|
echo " -m |--mode -- Set execution mode (default: default)"
|
||||||
echo " |--period -- Set schedule period time (default: '*/30 * * *')"
|
echo " |--period -- Set schedule period time (default: '0 1 * * *')"
|
||||||
echo " -t |--timeout -- Set timeout (default: 120s)"
|
echo " -t |--timeout -- Set timeout (default: 120s)"
|
||||||
echo " -h |--help -- Print this help message and exit"
|
echo " -h |--help -- Print this help message and exit"
|
||||||
echo " -V |--version -- Print version information and exit"
|
echo " -V |--version -- Print version information and exit"
|
||||||
|
|||||||
Reference in New Issue
Block a user