Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require "rubygems"
- require "nanite"
- puts "[XMAPPER] Starting mapper!"
- pid = fork do
- # $stdin.close
- # $stdout.close
- # $stderr.close
- Signal.trap('HUP', 'IGNORE') # Don't die upon logout
- EM.run do
- # start up a new mapper with a ping time of 10 seconds
- Nanite.start_mapper(:host => 'localhost', :user => 'mapper', :pass => 'testing', :vhost => '/nanite', :log_level => 'info', :requests_failsafe => true)
- EM.add_periodic_timer(300) do
- puts "[RUN] Dispatching check 5 min.."
- Nanite.push("/expire/check", "console")
- end
- EM.add_periodic_timer(30) do
- puts "[RUN] Dispatching check 30 sec.."
- Nanite.push("/expire/check", "console")
- end
- end
- end
- # Save a pid file and exit
- if pid
- pid_file = File.join(File.dirname(__FILE__), "..", "tmp", "pids", "rmapper.pid")
- File.open(pid_file, "w") { |f| f.write pid }
- exit
- end
Add Comment
Please, Sign In to add comment