forked from nbgallery/nbgallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cronic
executable file
·34 lines (27 loc) · 806 Bytes
/
cronic
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
#!/usr/bin/env ruby
# Usage:
#
# startup as daemon:
# script/cronic -d -l log/cronic.log -P tmp/pids/cronic.pid
#
# shutdown running daemon:
# script/cronic -k -P tmp/pids/cronic.pid
APP_PATH = File.expand_path('../config/application', __dir__)
require File.expand_path('../config/boot', __dir__)
require APP_PATH
Rails.application.require_environment!
require 'cronic'
require 'dante'
require 'mypki'
MyPKI.init
Dante.run('cronic scheduler') do
# Instantiate the scheduler.
# The optional hash argument is passed directly to Rufus::Scheduler.start_new
scheduler = Cronic::Scheduler.new
# scheduler = Cronic::Scheduler.new :frequency => 60.0
ScheduledJobs.job_files.each do |file|
Rails.logger.info("SCHEDULER: loading #{file}")
scheduler.load_jobs file
end
scheduler.join
end