sbin/jerbild in jerbil-1.3.3 vs sbin/jerbild in jerbil-1.4.5
- old
+ new
@@ -19,10 +19,11 @@
require 'jerbil'
require 'jerbil/servers'
require 'jerbil/config'
require 'jerbil/version'
require 'jerbil/support'
+require 'jerbil/monitor'
require 'jellog'
require 'jeckyl'
require 'socket'
@@ -155,28 +156,48 @@
exit 1
end
-logger.puts "Logging started for Jerbil Daemon"
+logger.puts "Logging started for Jerbil Daemon" if verbose
logger.puts "Daemonized" if verbose && daemonize
+# will only output messages to screen if not daemonised and therefore safe to
+# assume verbose anyway.
+
my_self = Jerbil::Servers.create_local_server(config[:environment], pkey)
logger.puts "Created local server: #{my_self.ident}"
jerbild = Jerbil::Broker.new(config, pkey)
logger.puts "Started Broker"
+logger.puts "Starting Monitor"
+
+# create a separate process to look for other servers
+# and log them to this one
+mon_pid = fork do
+
+ monitor = Jerbil::Monitor.new(config, pkey)
+
+ # exits automatically
+
+end
+
DRb.start_service(my_self.drb_address, jerbild)
logger.puts "Started DRb"
-# now create the pid file
-Jerbil::Support.write_pid_file(:jerbil, config[:environment], config[:pid_dir])
-logger.puts "Written pid #{Process.pid} to pid file"
+# now create the pid files
+jer_pid = Jerbil::Support.write_pid_file(:jerbil, config[:environment], config[:pid_dir])
+
+logger.puts "Written Jerbil pid #{jer_pid} to pid file"
+
+# Jerbil::Support.write_pid_file(:jmonitor, config[:environment], config[:pid_dir], mon_pid)
+#
+# logger.puts "Written Monitor pid #{mon_pid} to pid file"
$0 = "jerbild-#{config[:environment]}"
logger.puts "Changed process name for #{my_self.ident}"