Skip to content

Commit

Permalink
Support Initial Backups
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaiede committed Dec 6, 2024
1 parent eac2a93 commit 843f852
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions Sources/Bedrockifier/Model/ScheduleConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public struct ScheduleConfig: Codable {
public var daily: DayTime?
public var interval: String?
public var startupDelay: String?
public var runInitialBackup: Bool?

// Event Based Schedules
public var onPlayerLogin: Bool?
Expand Down
7 changes: 6 additions & 1 deletion Sources/Service/Service.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ final class BackupService {
}

if let minInterval = try schedule.parseMinInterval() {
BackupService.logger.info("Backup Minimum Interval is \(minInterval) seconds")
BackupService.logger.info("Backup Minimum Interval is \(minInterval) seconds.")
}
} else {
// Without the schedule, we have to assume the docker container specifies an interval
Expand All @@ -113,6 +113,11 @@ final class BackupService {
exit(-1)
}
}

if config.schedule?.runInitialBackup == true {
BackupService.logger.info("Performing Initial Backup...")
await self.backupActor.backupAllContainers(isDaily: true)
}
}

dispatchMain()
Expand Down

0 comments on commit 843f852

Please sign in to comment.