lib/octospy.rb in octospy-0.1.1 vs lib/octospy.rb in octospy-0.2.0

- old
+ new

@@ -44,10 +44,21 @@ ] end end end + def daemonize + Process.daemon(nochdir: nil, noclose: true) + File.open(Octospy.pid_file, 'w') { |f| f << Process.pid } + log = File.new(Octospy.log_file, 'a') + log.sync = Octospy.sync_log + STDIN.reopen '/dev/null' + STDOUT.reopen log + STDERR.reopen STDOUT + end + def run + self.daemonize if Octospy.daemonize self.irc_bot.start end end Dotenv.load ENV['DOTENV'] || '.env'