-
Notifications
You must be signed in to change notification settings - Fork 0
/
schedule.rb
68 lines (61 loc) · 1.52 KB
/
schedule.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require 'ext_whenever'
ExtWhenever.setup(self)
### NOTE
# https://linuxconfig.org/how-to-execute-less-than-1-minute-intervals-jobs-using-cron-time-based-scheduler
#
# Crontab (ubuntu)
# ----------------
# hourly --> on minute 17
# daily --> at 06h25m
# weekly --> on day 7 (sunday), at 06h47m
# monthly --> on day 01, at 06h52m
# EDT = UTC - (4|5) hours
#
# Examples
# --------
# every :month, at: "start of the month at 4:30 am" do
# TODO every first saturday of every month --> can't use whenever syntax --> week_of_the_year % total_year_weeks
# rake 'every_month'
# end
#
# every :week do
# runner 'EveryWeekJob.perform_later'
# end
#
# every :day, at: '8:00 am' do
# rake 'every_day'
# end
#
# every :minute do
# bash 'every_minute.sh'
# end
case @environment
when 'vagrant'
every :minute do
# bash_script 'version'
# bash_helper 'sun.os_name'
# rake 'zeitwerk:check'
end
when 'staging', 'production'
case @application
when 'web_tools'
every :sunday, at: '10:11 am' do
rake 'system:reboot'
end
every :day, at: '8:11 am' do
rake 'cron:every_day'
end
when 'web_cluster'
every :sunday, at: '10:01 am' do
rake 'system:reboot'
end
every :day, at: '8:01 am' do
rake 'cron:cluster:every_day'
end
end
end
raise "Setting[:monit_interval] < 1.minute" unless Setting[:monit_interval] >= 1.minute
raise "Setting[:monit_interval] > 20.minutes" unless Setting[:monit_interval] <= 20.minutes
every Setting[:monit_interval] do
rake 'task:runner[Monit.capture]'
end