Class: BatchManager::Daemon
- Inherits:
-
Object
- Object
- BatchManager::Daemon
- Includes:
- Utils
- Defined in:
- lib/batch_manager/daemon.rb
Defined Under Namespace
Classes: Spawn
Class Method Summary collapse
- .pid_file_path(batch_name, is_wet = false) ⇒ Object
- .spawn(command, batch_file, options = {}) ⇒ Object
Methods included from Utils
Class Method Details
.pid_file_path(batch_name, is_wet = false) ⇒ Object
19 20 21 22 |
# File 'lib/batch_manager/daemon.rb', line 19 def pid_file_path(batch_name, is_wet = false) pid_file_name = is_wet ? "#{batch_name}_wet" : batch_name File.join(BatchManager.log_dir, pid_file_name) + ".pid" end |
.spawn(command, batch_file, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/batch_manager/daemon.rb', line 8 def spawn(command, batch_file, = {}) = { working_dir: Rails.root.to_s, pid_file: pid_file_path(batch_name(batch_file), [:wet]), log_file: BatchManager::Logger.log_file_path(batch_name(batch_file), [:wet]), sync_log: true } FileUtils.mkdir_p(File.dirname([:pid_file]), :mode => 0775) Spawn.spawn!(, [command, batch_file, ]) end |