feed-updater
852 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 = {
:dir_mode => :normal,
:dir => File.dirname(__FILE__) + '/../tmp/pids',
:multiple => false,
:backtrace => true,
:monitor => false
}
OptionParser.new do |opts|
opts.on("-i", "--identifier=i", "Id") do |i|
options[:identifier] = i
end
end.parse!(ARGV)
Daemons.run_proc("feed-updater.#{options[:identifier]}", options) do
require NOOSFERO_ROOT + '/config/environment'
FeedUpdater.new.start
end