Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
Allow inbuilt scheduler to be disabled (#9)
Browse files Browse the repository at this point in the history
* Allow setting interval to -1 to disable scheduler

* Update README config example
  • Loading branch information
freddyheppell authored Jun 30, 2023
1 parent 9cd88cc commit 0eea8ca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ path-style-access: true
backup-date-format: dd-MM-yyyy-HH-mm-ss
# Interval in minutes in which to create an automatic backup
# Set to -1 to disable
backup-interval: 240
# Name of your s3 bucket
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/cloud/stonehouse/s3backup/S3Backup.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ public void onEnable() {
Objects.requireNonNull(this.getCommand("s3backup")).setExecutor(new CommandS3Backup(this));

int backupInterval = getFileConfig().getBackupInterval();
scheduler = new Scheduler(this).runTaskTimer(this,
20 * 60 * backupInterval,
20 * 60 * backupInterval);

if (backupInterval != -1) {
scheduler = new Scheduler(this).runTaskTimer(this,
20 * 60 * backupInterval,
20 * 60 * backupInterval);
}

setProgress(false);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ path-style-access: true
backup-date-format: dd-MM-yyyy-HH-mm-ss

# Interval in minutes in which to create an automatic backup
# Set to -1 to disable
backup-interval: 240

# Name of your s3 bucket
Expand Down

0 comments on commit 0eea8ca

Please sign in to comment.