lib/bluepill/process.rb in bluepill-0.0.11 vs lib/bluepill/process.rb in bluepill-0.0.12

- old
+ new

@@ -8,10 +8,11 @@ :stop_command, :restart_command, :daemonize, :pid_file, + :working_dir, :start_grace_time, :stop_grace_time, :restart_grace_time, @@ -228,16 +229,16 @@ def start_process logger.warning "Executing start command: #{start_command}" if self.daemonize? - child_pid = System.daemonize(start_command, :uid => self.uid, :gid => self.gid) + child_pid = System.daemonize(start_command, self.system_command_options) File.open(pid_file, "w") {|f| f.write(child_pid)} else # This is a self-daemonizing process - result = System.execute_blocking(start_command, :uid => self.uid, :gid => self.gid, :logger => logger) + result = System.execute_blocking(start_command, self.system_command_options) unless result[:exit_code].zero? logger.warning "Start command execution returned non-zero exit code:" logger.warning result.inspect end @@ -249,11 +250,11 @@ def stop_process if stop_command cmd = process_command(stop_command) logger.warning "Executing stop command: #{cmd}" - result = System.execute_blocking(cmd, :uid => self.uid, :gid => self.gid) + result = System.execute_blocking(cmd, self.system_command_options) unless result[:exit_code].zero? logger.warning "Stop command execution returned non-zero exit code:" logger.warning result.inspect end @@ -270,11 +271,11 @@ if restart_command cmd = process_command(restart_command) logger.warning "Executing restart command: #{cmd}" - result = System.execute_blocking(cmd, :uid => self.uid, :gid => self.gid) + result = System.execute_blocking(cmd, self.system_command_options) unless result[:exit_code].zero? logger.warning "Restart command execution returned non-zero exit code:" logger.warning result.inspect end @@ -368,9 +369,13 @@ Marshal.load(Marshal.dump(self)) end def process_command(cmd) cmd.to_s.gsub("{{PID}}", actual_pid.to_s) + end + + def system_command_options + {:uid => self.uid, :gid => self.gid, :working_dir => self.working_dir, :logger => self.logger} end end end \ No newline at end of file