Hello community, here is the log from the commit of package rubygem-daemons for openSUSE:Factory checked in at 2015-03-25 10:01:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-daemons (Old) and /work/SRC/openSUSE:Factory/.rubygem-daemons.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-daemons" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-daemons/rubygem-daemons.changes 2015-03-18 13:03:56.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-daemons.new/rubygem-daemons.changes 2015-03-25 10:01:33.000000000 +0100 @@ -1,0 +2,7 @@ +Sun Mar 22 09:14:13 UTC 2015 - [email protected] + +- updated to version 1.2.2 + * fix 100% CPU usage bug when using monitor mode. + * increase version number to be able to re-push to rubygems + +------------------------------------------------------------------- Old: ---- daemons-1.2.0.gem New: ---- daemons-1.2.2.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-daemons.spec ++++++ --- /var/tmp/diff_new_pack.KDcDCy/_old 2015-03-25 10:01:34.000000000 +0100 +++ /var/tmp/diff_new_pack.KDcDCy/_new 2015-03-25 10:01:34.000000000 +0100 @@ -24,7 +24,7 @@ # Name: rubygem-daemons -Version: 1.2.0 +Version: 1.2.2 Release: 0 %define mod_name daemons %define mod_full_name %{mod_name}-%{version} ++++++ daemons-1.2.0.gem -> daemons-1.2.2.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Releases new/Releases --- old/Releases 1970-01-01 01:00:00.000000000 +0100 +++ new/Releases 2015-03-17 20:35:46.000000000 +0100 @@ -1,5 +1,13 @@ = Daemons Release History +== Release 1.2.2: March 17, 2015 + +* fix 100% CPU usage bug when using monitor mode. + +== Release 1.2.1: March 10, 2015 + +* increase version number to be able to re-push to rubygems + == Release 1.2.0: March 8, 2015 * add options for custum log file names. Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/call/call.rb new/examples/call/call.rb --- old/examples/call/call.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/call/call.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,54 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +testfile = File.expand_path(__FILE__) + '.log' + +# On the first call to <tt<call</tt>, an application group (accessible by <tt>Daemons.group</tt>) +# will be created an the options will be kept within, so you only have to specify +# <tt>:multiple</tt> once. +# + +options = { + :app_name => 'mytask', +# :ontop => true, + :multiple => true +} + +Daemons.call(options) do + File.open(testfile, 'w') do |f| + f.puts 'test' + end + + loop { puts '1'; sleep 5 } +end +puts 'first task started' + +Daemons.call do + loop { puts '2'; sleep 4 } +end +puts 'second task started' + +# NOTE: this process will exit after 5 seconds +Daemons.call do + puts '3' + sleep 5 +end +puts 'third task started' + +puts 'waiting 20 seconds...' +sleep(20) + +# This call would result in an exception as it will try to kill the third process +# which has already terminated by that time; but using the 'true' parameter forces the +# stop_all procedure. +puts 'trying to stop all tasks...' +Daemons.group.stop_all(true) + +puts 'done' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/call/call_monitor.rb new/examples/call/call_monitor.rb --- old/examples/call/call_monitor.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/call/call_monitor.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,51 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +testfile = File.expand_path(__FILE__) + '.log' + +# On the first call to <tt<call</tt>, an application group (accessible by <tt>Daemons.group</tt>) +# will be created an the options will be kept within, so you only have to specify +# <tt>:multiple</tt> once. +# + +options = { +# :ontop => true, + :multiple => true, + :monitor => true +} + +Daemons.call(options) do + loop { puts '1'; sleep 20 } +end +puts 'first task started' + +# NOTE: this process will exit after 5 seconds +Daemons.call do + File.open(testfile, 'a') do |f| + f.puts 'started...' + puts '2' + + sleep 5 + + f.puts '...exit' + end +end +puts 'second task started' + +puts 'waiting 100 seconds...' +sleep(100) + +# This call would result in an exception as it will try to kill the third process +# which has already terminated by that time; but using the 'true' parameter forces the +# stop_all procedure. +puts 'trying to stop all tasks...' +Daemons.group.stop_all(true) + +puts 'done' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/daemonize/daemonize.rb new/examples/daemonize/daemonize.rb --- old/examples/daemonize/daemonize.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/daemonize/daemonize.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,23 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { + :log_output => true +} + +testfile = File.expand_path(__FILE__) + '.txt' + +Daemons.daemonize(options) + +puts 'some output...' + +File.open(testfile, 'w') do |f| + f.write('test') +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_crash.rb new/examples/run/ctrl_crash.rb --- old/examples/run/ctrl_crash.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_crash.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,16 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { + :log_output => true, + :backtrace => true +} + +Daemons.run(File.join(File.dirname(__FILE__), 'myserver_crashing.rb'), options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_custom_logfiles.rb new/examples/run/ctrl_custom_logfiles.rb --- old/examples/run/ctrl_custom_logfiles.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_custom_logfiles.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,18 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { + :log_output => true, + :backtrace => true, + :output_logfilename => "custom_output.txt", + :logfilename => "custom_log.log" +} + +Daemons.run(File.join(File.dirname(__FILE__), 'myserver_crashing.rb'), options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_exec.rb new/examples/run/ctrl_exec.rb --- old/examples/run/ctrl_exec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_exec.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,15 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { + :mode => :exec +} + +Daemons.run(File.join(File.dirname(__FILE__), 'myserver.rb'), options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_exit.rb new/examples/run/ctrl_exit.rb --- old/examples/run/ctrl_exit.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_exit.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,14 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { +} + +Daemons.run(File.join(File.dirname(__FILE__), 'myserver_exiting.rb'), options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_hanging.rb new/examples/run/ctrl_hanging.rb --- old/examples/run/ctrl_hanging.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_hanging.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,19 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { + #:mode => :exec, + :multiple => true, + :no_pidfiles => true, + :force_kill_waittime => 5 + #:force_kill_waittime => -1 # do not wait before killing -9 +} + +Daemons.run(File.join(File.dirname(__FILE__), 'myserver_hanging.rb'), options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_keep_pid_files.rb new/examples/run/ctrl_keep_pid_files.rb --- old/examples/run/ctrl_keep_pid_files.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_keep_pid_files.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,15 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { + :keep_pid_files => true +} + +Daemons.run(File.join(File.dirname(__FILE__), 'myserver.rb'), options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_monitor.rb new/examples/run/ctrl_monitor.rb --- old/examples/run/ctrl_monitor.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_monitor.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,15 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { + :monitor => true +} + +Daemons.run(File.join(File.dirname(__FILE__), 'myserver_crashing.rb'), options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_monitor_multiple.rb new/examples/run/ctrl_monitor_multiple.rb --- old/examples/run/ctrl_monitor_multiple.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_monitor_multiple.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,17 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { + :multiple => true, + :monitor => true, + :log_output => true, +} + +Daemons.run(File.join(File.dirname(__FILE__), 'myserver_crashing.rb'), options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_multiple.rb new/examples/run/ctrl_multiple.rb --- old/examples/run/ctrl_multiple.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_multiple.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,15 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { + :multiple => true +} + +Daemons.run(File.join(File.dirname(__FILE__), 'myserver.rb'), options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_normal.rb new/examples/run/ctrl_normal.rb --- old/examples/run/ctrl_normal.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_normal.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,11 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +Daemons.run(File.join(File.dirname(__FILE__), 'myserver.rb')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_ontop.rb new/examples/run/ctrl_ontop.rb --- old/examples/run/ctrl_ontop.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_ontop.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,15 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { + :ontop => true +} + +Daemons.run(File.join(File.dirname(__FILE__), 'myserver.rb'), options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_optionparser.rb new/examples/run/ctrl_optionparser.rb --- old/examples/run/ctrl_optionparser.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_optionparser.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,41 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' +require 'optparse' +require 'logger' +require 'ostruct' + +class MyApp < Logger::Application + def initialize(args) + super(self.class) + @options = OpenStruct.new(:daemonize => true) + opts = OptionParser.new do |opts| + opts.banner = 'Usage: myapp [options]' + opts.separator '' + opts.on('-N', '--no-daemonize', "Don't run as a daemon") do + @options.daemonize = false + end + end + @args = opts.parse!(args) + end + + def run + Daemons.run_proc('myapp', :ARGV => @args, :ontop => [email protected]) do + puts "@options.daemonize: #{@options.daemonize}" + STDOUT.sync = true + loop do + print '.' + sleep(2) + end + end + end +end + +myapp = MyApp.new(ARGV) +myapp.run diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_proc.rb new/examples/run/ctrl_proc.rb --- old/examples/run/ctrl_proc.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_proc.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,24 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { + :multiple => false, + :ontop => false, + :backtrace => true, + :log_output => true, + :monitor => true +} + +Daemons.run_proc('ctrl_proc.rb', options) do + loop do + puts 'ping from proc!' + sleep(3) + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_proc_multiple.rb new/examples/run/ctrl_proc_multiple.rb --- old/examples/run/ctrl_proc_multiple.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_proc_multiple.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,20 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { + :log_output => true, + :multiple => true, +} + +Daemons.run_proc('ctrl_proc_multiple.rb', options) do + puts 'hello' + sleep(5) + puts 'done' +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_proc_rand.rb new/examples/run/ctrl_proc_rand.rb --- old/examples/run/ctrl_proc_rand.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_proc_rand.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,21 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +Daemons.run_proc('myscript') do + loop do + file = File.open('/tmp/myscript.log', 'a') + file.write(Random.rand) # breaks without seeding + # file.write(Random.new.rand) # works without seeding + # file.write(rand) # also works, but this is Kernel.rand() so its different + file.write("\n") + file.close + sleep 2 + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_proc_simple.rb new/examples/run/ctrl_proc_simple.rb --- old/examples/run/ctrl_proc_simple.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_proc_simple.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,16 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +Daemons.run_proc('ctrl_proc_simple.rb') do + loop do + puts 'ping from proc!' + sleep(3) + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/ctrl_slowstop.rb new/examples/run/ctrl_slowstop.rb --- old/examples/run/ctrl_slowstop.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/ctrl_slowstop.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,16 @@ +lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '../../lib')) + +if File.exist?(File.join(lib_dir, 'daemons.rb')) + $LOAD_PATH.unshift lib_dir +else + begin; require 'rubygems'; rescue ::Exception; end +end + +require 'daemons' + +options = { + #:force_kill_waittime => 40 + #:force_kill_waittime => -1 # do not wait before killing -9 +} + +Daemons.run(File.join(File.dirname(__FILE__), 'myserver_slowstop.rb'), options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/myserver.rb new/examples/run/myserver.rb --- old/examples/run/myserver.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/myserver.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby + +# This is myserver.rb, an example server that is to be controlled by daemons +# and that does nothing really useful at the moment. +# +# Don't run this script by yourself, it can be controlled by the ctrl*.rb scripts. + +loop do + puts 'ping from myserver.rb!' + sleep(3) +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/myserver_crashing.rb new/examples/run/myserver_crashing.rb --- old/examples/run/myserver_crashing.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/myserver_crashing.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,14 @@ +# This is myserver.rb, an example server that is to be controlled by daemons +# and that does nothing really useful at the moment. +# +# Don't run this script by yourself, it can be controlled by the ctrl*.rb scripts. + +loop do + puts 'ping from myserver.rb!' + puts 'this example server will crash in 10 seconds...' + + sleep(10) + + puts 'CRASH!' + fail 'CRASH!' +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/myserver_exiting.rb new/examples/run/myserver_exiting.rb --- old/examples/run/myserver_exiting.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/myserver_exiting.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,8 @@ +loop do + puts 'ping from myserver.rb!' + puts 'this example server will exit in 3 seconds...' + + sleep(3) + + Process.exit +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/myserver_hanging.rb new/examples/run/myserver_hanging.rb --- old/examples/run/myserver_hanging.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/myserver_hanging.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,20 @@ +#!/usr/bin/env ruby + +# This is myserver.rb, an example server that is to be controlled by daemons +# and that does nothing really useful at the moment. +# +# Don't run this script by yourself, it can be controlled by the ctrl*.rb scripts. + +trap('TERM') do + puts 'received TERM' + + loop do + puts 'hanging!' + sleep(3) + end +end + +loop do + puts 'ping from myserver.rb!' + sleep(3) +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/examples/run/myserver_slowstop.rb new/examples/run/myserver_slowstop.rb --- old/examples/run/myserver_slowstop.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/examples/run/myserver_slowstop.rb 2015-03-17 20:35:46.000000000 +0100 @@ -0,0 +1,20 @@ +#!/usr/bin/env ruby + +# This is myserver_slowstop.rb, an example server that is to be controlled by daemons +# and that does nothing really useful at the moment. +# +# Don't run this script by yourself, it can be controlled by the ctrl*.rb scripts. + +trap('TERM') do + puts 'received TERM' + + # simulate the slow stopping + sleep(10) + + exit +end + +loop do + puts 'ping from myserver.rb!' + sleep(3) +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/daemons/application.rb new/lib/daemons/application.rb --- old/lib/daemons/application.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/daemons/application.rb 2015-03-17 20:35:46.000000000 +0100 @@ -152,8 +152,7 @@ @pid.pid = Process.pid ENV['DAEMONS_ARGV'] = @controller_argv.join(' ') - # haven't tested yet if this is really passed to the exec'd process... - + started Kernel.exec(script, *(@app_argv || [])) end @@ -215,7 +214,7 @@ ARGV.concat @app_argv if @app_argv started - # TODO: begin - rescue - end around this and exception logging + # TODO: exception logging load script end @@ -425,11 +424,11 @@ end def zap - @pid.cleanup + @pid.zap end def zap! - begin; @pid.cleanup; rescue ::Exception; end + begin; @pid.zap; rescue ::Exception; end end def show_status diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/daemons/application_group.rb new/lib/daemons/application_group.rb --- old/lib/daemons/application_group.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/daemons/application_group.rb 2015-03-17 20:35:46.000000000 +0100 @@ -6,8 +6,6 @@ attr_reader :monitor - # attr_reader :controller - attr_reader :options attr_reader :applications @@ -29,11 +27,8 @@ @script = File.expand_path(options[:script]) end - # @controller = controller @monitor = nil - # options = controller.options - @multiple = options[:multiple] || false @dir_mode = options[:dir_mode] || :script @@ -42,7 +37,6 @@ @keep_pid_files = options[:keep_pid_files] || false @no_pidfiles = options[:no_pidfiles] || false - # @applications = find_applications(pidfile_dir()) @applications = [] end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/daemons/cmdline.rb new/lib/daemons/cmdline.rb --- old/lib/daemons/cmdline.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/daemons/cmdline.rb 2015-03-17 20:35:46.000000000 +0100 @@ -9,10 +9,6 @@ @opts = OptionParser.new do |opts| opts.banner = '' -# opts.on("-v", "--[no-]verbose", "Run verbosely") do |v| -# @options[:verbose] = v -# end - opts.on('-t', '--ontop', 'Stay on top (does not daemonize)') do |t| @options[:ontop] = t end @@ -25,16 +21,11 @@ @options[:no_wait] = t end - # opts.separator "" - # opts.separator "Specific options:" - opts.separator '' opts.separator 'Common options:' # No argument, shows at tail. This will print an options summary opts.on_tail('-h', '--help', 'Show this message') do - # puts opts - # @usage = controller.print_usage exit @@ -62,15 +53,12 @@ end end - # # Return a hash describing the options. # def parse(args) # The options specified on the command line will be collected in *options*. # We set default values here. - # options = {} - - # #pp args + @opts.parse(args) @options diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/daemons/controller.rb new/lib/daemons/controller.rb --- old/lib/daemons/controller.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/daemons/controller.rb 2015-03-17 20:35:46.000000000 +0100 @@ -38,7 +38,6 @@ # Note that this function should only update <tt>@options</tt> and no other variables. # def setup_options - # @options[:ontop] ||= true end def run diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/daemons/monitor.rb new/lib/daemons/monitor.rb --- old/lib/daemons/monitor.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/daemons/monitor.rb 2015-03-17 20:35:46.000000000 +0100 @@ -49,14 +49,10 @@ Process.detach(fork { a.start(restart = true) }) sleep(5) - - # application_group.setup end end - # sleep(5) - # application_group.setup - # sleep(30) + sleep(30) end end private :watch @@ -67,21 +63,6 @@ begin @pid.pid = Process.pid - - # at_exit { - # begin; @pid.cleanup; rescue ::Exception; end - # } - - # This part is needed to remove the pid-file if the application is killed by - # daemons or manually by the user. - # Note that the applications is not supposed to overwrite the signal handler for - # 'TERM'. - # - # trap('TERM') { - # begin; @pid.cleanup; rescue ::Exception; end - # exit - # } - watch(application_group) rescue ::Exception => e begin @@ -124,13 +105,13 @@ end end rescue ::Exception => e - puts "#{e} #{pid}" + puts "exception while trying to stop monitor process #{pid}: #{e}" puts 'deleting pid-file.' end - # We try to remove the pid-files by ourselves, in case the application + # We try to remove the pid-files by ourselves, in case the monitor # didn't clean it up. - begin; @pid.cleanup; rescue ::Exception; end + begin; @pid.zap; rescue ::Exception; end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/daemons/pid.rb new/lib/daemons/pid.rb --- old/lib/daemons/pid.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/daemons/pid.rb 2015-03-17 20:35:46.000000000 +0100 @@ -18,8 +18,6 @@ return false rescue ::Exception # for example on EPERM (process exists but does not belong to us) return true - # rescue Errno::EPERM - # return false end end @@ -67,6 +65,10 @@ # Cleanup method def cleanup end + + # Zap method + def zap + end # Exist? method def exist? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/daemons/pidfile.rb new/lib/daemons/pidfile.rb --- old/lib/daemons/pidfile.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/daemons/pidfile.rb 2015-03-17 20:35:46.000000000 +0100 @@ -99,11 +99,15 @@ File.delete(filename) if pid == Process.pid end + def zap + File.delete(filename) + end + def pid begin File.open(filename) do |f| p = f.gets.to_i - return nil if p == 0 # Otherwise an invalid pid file becomes pid 0 + return nil if p == 0 # Otherwise an invalid pid file becomes pid 0 return p end rescue ::Exception diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/daemons/version.rb new/lib/daemons/version.rb --- old/lib/daemons/version.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/daemons/version.rb 2015-03-17 20:35:46.000000000 +0100 @@ -1,3 +1,3 @@ module Daemons - VERSION = '1.2.0' + VERSION = '1.2.2' end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 1970-01-01 01:00:00.000000000 +0100 +++ new/metadata 2015-03-17 20:35:46.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: daemons version: !ruby/object:Gem::Version - version: 1.2.0 + version: 1.2.2 platform: ruby authors: - Thomas Uehlinger @@ -29,6 +29,31 @@ - LICENSE - README.md - Releases +- examples/call/call.rb +- examples/call/call_monitor.rb +- examples/daemonize/daemonize.rb +- examples/run/ctrl_crash.rb +- examples/run/ctrl_custom_logfiles.rb +- examples/run/ctrl_exec.rb +- examples/run/ctrl_exit.rb +- examples/run/ctrl_hanging.rb +- examples/run/ctrl_keep_pid_files.rb +- examples/run/ctrl_monitor.rb +- examples/run/ctrl_monitor_multiple.rb +- examples/run/ctrl_multiple.rb +- examples/run/ctrl_normal.rb +- examples/run/ctrl_ontop.rb +- examples/run/ctrl_optionparser.rb +- examples/run/ctrl_proc.rb +- examples/run/ctrl_proc_multiple.rb +- examples/run/ctrl_proc_rand.rb +- examples/run/ctrl_proc_simple.rb +- examples/run/ctrl_slowstop.rb +- examples/run/myserver.rb +- examples/run/myserver_crashing.rb +- examples/run/myserver_exiting.rb +- examples/run/myserver_hanging.rb +- examples/run/myserver_slowstop.rb - lib/daemons.rb - lib/daemons/application.rb - lib/daemons/application_group.rb @@ -63,7 +88,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.0.14 +rubygems_version: 2.4.6 signing_key: specification_version: 4 summary: A toolkit to create and control daemons in different ways -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
