Schedule

Backup Schedule

Since: 1.3.0

GoBackup is built in a daemon mode, use gobackup start to start as a service in the background.

You can configure the schedule for each model, it will run backup task at the time you set.

models:
  my_backup:
    schedule:
      # At 04:05 on Sunday.
      cron: "5 4 * * sun"
    storages:
      local:
        type: local
        path: /path/to/backups
    databases:
      mysql:
        type: mysql
        host: localhost
        port: 3306
        database: my_database
        username: root
        password: password
  other_backup:
    # At 04:05 on every day.
    schedule:
      every: "1day"
      at: "04:05"
    storages:
      local:
        type: local
        path: /path/to/backups
    databases:
      mysql:
        type: mysql
        host: localhost
        port: 3306
        database: my_database
        username: root
        password: password

And then start daemon:

gobackup start

Now, there has a service named gobackup running in background.

$ ps aux | grep gobackup
jason            20443   0.0  0.1 409232800   8912   ??  Ss    7:47PM   0:00.02 gobackup run

NOTE: If you wants start without daemon, use gobackup run instead.

Signal handling

GoBackup will handle the following signals:

  • HUP - Hot reload the configuration.
  • QUIT - Graceful shutdown.
# Reload configuration
$ kill -HUP 20443
# Exit daemon
$ kill -QUIT 20443

Alternative to use crontab to run backup

You may want run backup in scheduled, you need Crontab (opens in a new tab):

crontab -e

Append this line and save it:

0 0 * * * /usr/local/bin/gobackup perform >> ~/.gobackup/gobackup.log

0 0 * * * means run at 0:00 AM, every day.

And after a day, you can check the execute status by ~/.gobackup/gobackup.log.