feed-updater
923 Bytes
#!/usr/bin/env ruby
# This is the Noosfero feed updater controller script. It starts and stops the
# feed updater daemon, which is implemented in the FeedUpdater class.
#
# The role of this script is to just start/stop the daemon, write a PID file,
# etc. The actual feed update logic is in FeedUpdater.
require 'daemons'
require 'optparse'
NOOSFERO_ROOT = File.expand_path(File.dirname(__FILE__) + '/../')
options = {
:app_name => 'feed-updater.default',
:dir_mode => :normal,
:dir => File.dirname(__FILE__) + '/../tmp/pids',
:multiple => false,
:backtrace => true,
:log_output => true,
:monitor => false
}
OptionParser.new do |opts|
opts.on("-i", "--identifier=i", "Id") do |i|
options[:app_name] = "feed-updater.#{i}"
end
end.parse!(ARGV)
Daemons.run_proc(options[:app_name], options) do
Dir.chdir NOOSFERO_ROOT
require './config/environment'
FeedUpdater.new.start
end