FEATURE: new 'backup_time_of_day' site setting
This commit is contained in:
parent
16f509afb9
commit
72a7bd38e1
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class ScheduleBackup < Jobs::Scheduled
|
class ScheduleBackup < Jobs::Scheduled
|
||||||
daily at: 3.hours
|
daily at: 0.hours
|
||||||
sidekiq_options retry: false
|
sidekiq_options retry: false
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
|
@ -12,7 +12,12 @@ module Jobs
|
||||||
return if (date + SiteSetting.backup_frequency.days) > Time.now.to_date
|
return if (date + SiteSetting.backup_frequency.days) > Time.now.to_date
|
||||||
end
|
end
|
||||||
|
|
||||||
Jobs.enqueue_in(rand(10.minutes), :create_backup)
|
Jobs.cancel_scheduled_job(:create_backup)
|
||||||
|
|
||||||
|
time_of_day = Time.parse(SiteSetting.backup_time_of_day)
|
||||||
|
seconds = time_of_day.hour.hours + time_of_day.min.minutes + rand(10.minutes)
|
||||||
|
|
||||||
|
Jobs.enqueue_in(seconds, :create_backup)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -965,6 +965,7 @@ en:
|
||||||
backup_frequency: "How frequently we create a site backup, in days."
|
backup_frequency: "How frequently we create a site backup, in days."
|
||||||
enable_s3_backups: "Upload backups to S3 when complete. IMPORTANT: requires valid S3 credentials entered in Files settings."
|
enable_s3_backups: "Upload backups to S3 when complete. IMPORTANT: requires valid S3 credentials entered in Files settings."
|
||||||
s3_backup_bucket: "The remote bucket to hold backups. WARNING: Make sure it is a private bucket."
|
s3_backup_bucket: "The remote bucket to hold backups. WARNING: Make sure it is a private bucket."
|
||||||
|
backup_time_of_day: "Time of day when the backup should occur."
|
||||||
|
|
||||||
active_user_rate_limit_secs: "How frequently we update the 'last_seen_at' field, in seconds"
|
active_user_rate_limit_secs: "How frequently we update the 'last_seen_at' field, in seconds"
|
||||||
verbose_localization: "Show extended localization tips in the UI"
|
verbose_localization: "Show extended localization tips in the UI"
|
||||||
|
|
|
@ -850,6 +850,9 @@ backups:
|
||||||
default: ''
|
default: ''
|
||||||
regex: "^[^A-Z_.]+$" # can't use '.' when using HTTPS
|
regex: "^[^A-Z_.]+$" # can't use '.' when using HTTPS
|
||||||
shadowed_by_global: true
|
shadowed_by_global: true
|
||||||
|
backup_time_of_day:
|
||||||
|
default: '3:30'
|
||||||
|
regex: "^((0?(0|1|2|3|4|5|6|7|8|9)|(10|11|12|13|14|15|16|17|18|19|20|21|22|23))):\\d\\d$"
|
||||||
|
|
||||||
uncategorized:
|
uncategorized:
|
||||||
version_checks:
|
version_checks:
|
||||||
|
|
Loading…
Reference in New Issue