daemon-ogre 1.4.9 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/daemon-ogre.rb CHANGED
@@ -1,711 +1,6 @@
1
- #DaemonOgreBody
2
- begin
3
- module DaemonOgre
4
-
5
- #OgreClassMethods
6
- begin
7
- class << self
8
- #Based on the rb location
9
- def load_directory(directory,*args)
10
- arg = Hash[*args]
11
-
12
- #directory = File.expand_path(directory)
13
- delayed_loads = Array.new
14
-
15
- if !arg[:delayed].nil?
16
- raise ArgumentError, "Delayed items must be in an "+\
17
- "Array! Example:\n:delayed => ['abc']" if arg[:delayed].class != Array
18
- end
19
-
20
- if !arg[:excluded].nil?
21
- raise ArgumentError, "Exclude items must be in an "+\
22
- "Array! Example:\n:exclude => ['abc']" if arg[:excluded].class != Array
23
- end
24
-
25
- arg[:type]= "rb" if arg[:type].nil?
26
- arg[:monkey_patch]= 0 if arg[:monkey_patch].nil?
27
-
28
- #=============================================================================================================
29
-
30
- ### GET Pre path + validation
31
- begin
32
- #get method callers path
33
-
34
- pre_path = caller[arg[:monkey_patch].to_i].split('.rb:').first+('.rb')
35
-
36
- if !pre_path.include?('/') && !pre_path.include?('\\')
37
- pre_path = File.expand_path(pre_path)
38
- end
39
-
40
- separator_symbol= String.new
41
- pre_path.include?('/') ? separator_symbol = '/' : separator_symbol = '\\'
42
-
43
- pre_path= ((pre_path.split(separator_symbol))-([pre_path.split(separator_symbol).pop])).join(separator_symbol)
44
-
45
- end
46
-
47
- puts "prepath: "+pre_path.inspect if $DEBUG
48
-
49
- puts "LOADING_FILES_FROM_"+directory.to_s.split(separator_symbol).last.split('.').first.capitalize if $DEBUG
50
-
51
- puts "Elements found in #{directory}" if $DEBUG
52
- puts File.join("#{pre_path}","#{directory}","**","*.#{arg[:type]}") if $DEBUG
53
- puts Dir[File.join("#{pre_path}","#{directory}","**","*.#{arg[:type]}")].sort.inspect if $DEBUG
54
-
55
- Dir[File.join("#{pre_path}","#{directory}","**","*.#{arg[:type]}")].sort.each do |file|
56
-
57
- arg[:delayed]= [nil] if arg[:delayed].nil?
58
- arg[:excluded]= [nil] if arg[:excluded].nil?
59
-
60
- arg[:excluded].each do |except|
61
- if file.split(separator_symbol).last.split('.').first == except.to_s.split('.').first
62
-
63
- puts file.to_s + " cant be loaded because it's an exception" if $DEBUG
64
-
65
- else
66
-
67
- arg[:delayed].each do |delay|
68
-
69
- if file.split(separator_symbol).last.split('.').first == delay.to_s.split('.').first
70
- delayed_loads.push(file)
71
- else
72
- load(file)
73
- puts file.to_s if $DEBUG
74
- end
75
-
76
- end
77
-
78
- end
79
- end
80
- end
81
- delayed_loads.each do |delayed_load_element|
82
- load(delayed_load_element)
83
- puts delayed_load_element.to_s if $DEBUG
84
- end
85
- puts "DONE_LOAD_FILES_FROM_"+directory.to_s.split(separator_symbol).last.split('.').first.capitalize if $DEBUG
86
-
87
- end
88
-
89
- def get_port(port,max_port=65535 ,host="0.0.0.0")
90
-
91
- require 'socket'
92
- port = port.to_i
93
-
94
- begin
95
- server = TCPServer.new('0.0.0.0', port)
96
- server.close
97
- return port
98
- rescue Errno::EADDRINUSE
99
- port = port.to_i + 1 if port < max_port+1
100
- retry
101
- end
102
-
103
- end
104
-
105
- def error_logger(error_msg,prefix="",log_file=App.log_path)
106
-
107
- ###convert error msg to more human friendly one
108
- begin
109
- error_msg= error_msg.to_s.gsub('", "','",'+"\n\"")
110
- rescue Exception
111
- error_msg= error_msg.inspect.gsub('", "','",'+"\n\"")
112
- end
113
-
114
- if File.exists?(File.expand_path(log_file))
115
- error_log = File.open( File.expand_path(log_file), "a+")
116
- error_log << "\n#{Time.now} | #{prefix}#{":" if prefix != ""} #{error_msg}"
117
- error_log.close
118
- else
119
- File.new(File.expand_path(log_file), "w").write(
120
- "#{Time.now} | #{prefix}#{":" if prefix != ""} #{error_msg}"
121
- )
122
- end
123
-
124
- return {:error => error_msg}
125
- end
126
-
127
- def load_ymls(directory,*args)
128
- arg= Hash[*args]
129
-
130
- require 'yaml'
131
- #require "hashie"
132
-
133
- arg[:monkey_patch]= 0 if arg[:monkey_patch].nil?
134
-
135
-
136
- ### GET Pre path + validation
137
- begin
138
- #get method callers path
139
- pre_path = caller[arg[:monkey_patch].to_i].split('.rb:').first+('.rb')
140
- if !pre_path.include?('/') && !pre_path.include?('\\')
141
- pre_path = File.expand_path(pre_path)
142
- end
143
- separator_symbol= String.new
144
- pre_path.include?('/') ? separator_symbol = '/' : separator_symbol = '\\'
145
- pre_path= ((pre_path.split(separator_symbol))-([pre_path.split(separator_symbol).pop])).join(separator_symbol)
146
- end
147
-
148
- puts "Elements found in #{directory}" if $DEBUG
149
- puts File.join("#{pre_path}","#{directory}","**","*.yml") if $DEBUG
150
- puts Dir[File.join("#{pre_path}","#{directory}","**","*.yml")].sort.inspect if $DEBUG
151
-
152
- yaml_files = Dir[File.join("#{pre_path}","#{directory}","**","*.yml")].sort
153
-
154
- puts "\nyaml file found: "+yaml_files.inspect if $DEBUG
155
-
156
- @result_hash = {}
157
- yaml_files.each_with_index do |full_path_file_name|
158
-
159
-
160
- file_name = full_path_file_name.split(separator_symbol).last.split(separator_symbol).first
161
-
162
- hash_key = file_name
163
- @result_hash[hash_key] = YAML.load(File.read("#{full_path_file_name}"))
164
-
165
- #@result_hash = @result_hash.merge!(tmp_hash)
166
-
167
-
168
- puts "==========================================================" if $DEBUG
169
- puts "Loading "+file_name.to_s.capitalize+"\n" if $DEBUG
170
- puts YAML.load(File.read("#{full_path_file_name}")) if $DEBUG
171
- puts "__________________________________________________________" if $DEBUG
172
-
173
- end
174
-
175
- puts "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" if $DEBUG
176
- puts "The Main Hash: \n"+@result_hash.inspect.to_s if $DEBUG
177
- puts "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" if $DEBUG
178
-
179
- return @result_hash
180
- end
181
-
182
- def create_on_filesystem(route_name,optionable_file_mod="w",optionable_data=nil)
183
- begin
184
-
185
- #file_name generate
186
- if !route_name.to_s.split('/').last.nil? || route_name.to_s.split('/').last != ''
187
- file_name = route_name.to_s.split('/').last
188
- else
189
- file_name = nil?
190
- end
191
-
192
- #path_way
193
- begin
194
- raise ArgumentError, "missing route_name: #{route_name}" if route_name.nil?
195
- path = File.expand_path(route_name).to_s.split('/')
196
- path = path - [File.expand_path(route_name).to_s.split('/').last]
197
- path.shift
198
- end
199
-
200
- #job
201
- begin
202
- if !Dir.exists?('/'+path.join('/'))
203
-
204
- at_now = '/'
205
- path.each do |dir_to_be_checked|
206
-
207
- at_now += "#{dir_to_be_checked}/"
208
- Dir.mkdir(at_now) if !Dir.exists?(at_now)
209
-
210
- end
211
- end
212
- end
213
-
214
- #file_create
215
- File.new("/#{path.join('/')}/#{file_name}", optionable_file_mod ).write optionable_data
216
-
217
- rescue Exception => ex
218
- puts ex
219
- end
220
- end
221
-
222
- def process_running?(input)
223
- begin
224
- Process.getpgid input.chomp.to_i
225
- return true
226
- rescue Exception
227
- return false
228
- end
229
- end
230
-
231
- def clone_mpath(original_path,new_name)
232
- log_path = File.expand_path(original_path)
233
- log_path = log_path.split('/')
234
- log_path.pop
235
- log_path.push(new_name)
236
- log_path = log_path.join('/')
237
-
238
- return log_path
239
- end
240
-
241
- end
242
- end
243
-
244
- #config
245
- begin
246
- class App
247
- class << self
248
- attr_accessor :log_path,
249
- :pid_path,
250
- :daemon_stderr,
251
- :exceptions,
252
- :exlogger,
253
- :app_name,
254
- :port,
255
- :terminate
256
- end
257
- end
258
- end
259
-
260
- #default
261
- begin
262
- App.log_path = "./var/log/logfile.log"
263
- App.pid_path = "./var/pid/pidfile.pid"
264
- App.terminate = false
265
- App.port = 80
266
- App.app_name = $0
267
-
268
- begin
269
- ['daemon_stderr','exceptions','exlogger'].each do |one_log|
270
-
271
- App.__send__(one_log+"=",clone_mpath(App.log_path,one_log+".log"))
272
-
273
- end
274
- end
275
-
276
- end
277
-
278
- #DaemonEngine
279
- begin
280
- class Daemon
281
- # Checks to see if the current process is the child process and if not
282
- # will update the pid file with the child pid.
283
- def self.start pid, pidfile, outfile, errfile
284
- unless pid.nil?
285
- raise "Fork failed" if pid == -1
286
- write pid, pidfile #if kill pidfile
287
- exit
288
- else
289
- redirect outfile, errfile
290
- end
291
- end
292
-
293
- # Attempts to write the pid of the forked process to the pid file.
294
- def self.write pid, pidfile
295
- DaemonOgre.create_on_filesystem pidfile
296
- File.open pidfile, "a+" do |new_line|
297
- new_line.write "#{pid}\n"
298
- end
299
- rescue ::Exception => e
300
- $stderr.puts "While writing the PID to file, unexpected #{e.class}: #{e}"
301
- Process.kill "HUP", pid
302
- end
303
-
304
- # Try and read the existing pid from the pid file and signal the
305
- # process. Returns true for a non blocking status.
306
- def self.kill(pidfile)
307
- opid = open("./#{pidfile}").read.strip.to_i
308
- Process.kill 'HUP', opid.to_i
309
- true
310
- rescue Errno::ENOENT
311
- $stdout.puts "#{pidfile} did not exist: Errno::ENOENT" if $DEBUG
312
- true
313
- rescue Errno::ESRCH
314
- $stdout.puts "The process #{opid} did not exist: Errno::ESRCH" if $DEBUG
315
- true
316
- rescue Errno::EPERM
317
- $stderr.puts "Lack of privileges to manage the process #{opid}: Errno::EPERM" if $DEBUG
318
- false
319
- rescue ::Exception => e
320
- $stderr.puts "While signaling the PID, unexpected #{e.class}: #{e}" if $DEBUG
321
- false
322
- end
323
-
324
- # Send stdout and stderr to log files for the child process
325
- def self.redirect outfile, errfile
326
- $stdin.reopen '/dev/null'
327
- out = File.new outfile, "a"
328
- err = File.new errfile, "a"
329
- $stdout.reopen out
330
- $stderr.reopen err
331
- $stdout.sync = $stderr.sync = true
332
- end
333
- end
334
- end
335
-
336
- #server_model
337
- begin
338
- class Server
339
- @@startup = false
340
- class << self
341
-
342
- def daemon
343
- puts "#{$0} daemon is watching you..."
344
- DaemonOgre.create_on_filesystem DaemonOgre::App.pid_path,
345
- 'a+'
346
- DaemonOgre.create_on_filesystem DaemonOgre::App.log_path,
347
- 'a+'
348
- DaemonOgre.create_on_filesystem DaemonOgre::App.daemon_stderr,
349
- 'a+'
350
-
351
-
352
- DaemonOgre::Daemon.start fork,
353
- DaemonOgre::App.pid_path,
354
- DaemonOgre::App.log_path,
355
- DaemonOgre::App.daemon_stderr
356
- end
357
-
358
- def debug
359
- $DEBUG = true
360
- end
361
-
362
- def help
363
- puts "\nyou can use one of these commands: "+\
364
- "\nstart daemon -d stop restart log -l pid -p port -tcp status reset help"+\
365
- "\n==============================================================================DESC======>>"
366
- puts "start\t\t\t\t=> this will start the #{$0}"+\
367
- "\ndaemon\t\t\t\t=> this will make is daemon process"+\
368
- "\nstop\t\t\t\t=> this will kill the last process with pidfile"+\
369
- "\nrestart\t\tor reset\t=> hard restart"+\
370
- "\nlog\t\tor -l\t\t=> logfile place"+\
371
- "\npid\t\tor -p\t\t=> pid file place (if you want set the filename as well, put .pid or .txt in the end)"+\
372
- "\nport\t\tor -tcp\t\t=> user definiated port"+\
373
- "\nstatus\t\t\t\t=> last process alive?"+\
374
- "\ndebug\t\tor -d\t\t=> show debug log (you can make your own by using 'puts 'xy' if $DEBUG' "+\
375
- "\nhelp\t\t\t\tgive you this msg :)\n"
376
- DaemonOgre::App.terminate=true
377
- end
378
-
379
- def start
380
- if File.exist?(File.expand_path(App.pid_path))
381
- text = File.open(File.expand_path(App.pid_path)).read
382
- terminate_on_command = Array.new
383
- text.each_line do |line|
384
- terminate_on_command.push DaemonOgre.process_running?(line)
385
- end
386
- end
387
-
388
- if !terminate_on_command.nil?
389
- if !terminate_on_command.include?(true)
390
- @@startup = true
391
- else
392
- puts "sorry but process is already running in this specification"
393
- Process.exit
394
- end
395
- else
396
- @@startup = true
397
- end
398
- end
399
-
400
- def stop
401
- puts "#{$0} is going to be FacePalmed..."
402
- Daemon.kill DaemonOgre::App.pid_path
403
- kill_with_pid
404
- File.open(DaemonOgre::App.pid_path, "w").write("")
405
- DaemonOgre::App.terminate=true
406
-
407
- end
408
-
409
- def restart
410
-
411
- Daemon.kill DaemonOgre::App.pid_path
412
- kill_with_pid
413
- File.open(DaemonOgre::App.pid_path, "w").write("")
414
- start
415
-
416
- end
417
-
418
- def kill_with_pid
419
- begin
420
- if File.exists?(DaemonOgre::App.pid_path)
421
- puts "PidFile found, processing..." if $DEBUG
422
- File.open(DaemonOgre::App.pid_path).each_line do |row|
423
- begin
424
- Process.kill 'TERM', row.to_i
425
- puts "terminated process at: #{row}" if $DEBUG
426
- rescue Exception => ex
427
- puts "At process: #{row}, #{ex}" if $DEBUG
428
- end
429
- end
430
- else
431
- system "ps -ef | grep #{$0}"
432
- #system "netstat --listen"
433
- #puts "\nLepton is around 10300-10399"
434
- end
435
- rescue Exception => ex
436
- puts "Exception has occured: #{ex}"
437
- end
438
- end
439
-
440
- def continue?
441
- Process.exit if !@@startup
442
- end
443
-
444
- def set_log(param)
445
- ARGV.each do |one_parameter|
446
- if one_parameter == param
447
- DaemonOgre::App.log_path= ARGV[ARGV.index(one_parameter)+1]
448
- end
449
- end
450
- end
451
-
452
- def set_pid(param)
453
- ARGV.each do |one_parameter|
454
- if one_parameter == param
455
- if ARGV[ARGV.index(one_parameter)+1].to_s.include?(".pid") ||\
456
- ARGV[ARGV.index(one_parameter)+1].to_s.include?(".txt")
457
- DaemonOgre::App.pid_path= ARGV[ARGV.index(one_parameter)+1]
458
- else
459
- DaemonOgre::App.pid_path= ARGV[ARGV.index(one_parameter)+1].to_s+"lepton.pid"
460
- end
461
- end
462
- end
463
- end
464
-
465
- def set_port(param)
466
- ARGV.each do |one_parameter|
467
- if one_parameter == param
468
- DaemonOgre::App.port= ARGV[ARGV.index(one_parameter)+1]
469
- end
470
- end
471
- end
472
-
473
- def pid
474
- begin
475
- if !DaemonOgre::App.pid_path.nil?
476
- DaemonOgre::App.pid_path+="lepton.pid" if !DaemonOgre::App.pid_path.include?(".pid")
477
- pre_path = File.dirname "#{File.dirname(__FILE__)}/#{DaemonOgre::App.pid_path}"
478
- pre_path_array = pre_path.split('/') - [ pre_path[0].to_s ]
479
- if !Dir.exists?(pre_path)
480
- at_now = String.new
481
- pre_path_array.each do |one_dir_to_be_made|
482
- #at_now show the place where we are now
483
- at_now == "" ? at_now += one_dir_to_be_made : at_now += "/"+one_dir_to_be_made
484
- if !Dir.exists?("#{File.dirname(__FILE__)}/#{at_now}")
485
- Dir.mkdir("#{File.dirname(__FILE__)}/#{at_now}")
486
- end
487
- end
488
- end
489
- File.new("#{File.dirname(__FILE__)}/#{DaemonOgre::App.pid_path}", "a+").write Process.pid.to_s+"\n"
490
- end
491
- rescue Exception => ex
492
- ex.logger
493
- end
494
- end
495
-
496
- def pid_check
497
- if File.exist?(File.expand_path(App.pid_path))
498
- puts "checking pidfile:"
499
- text = File.open(File.expand_path(App.pid_path)).read
500
- text.each_line do |line|
501
- puts "#{line.chomp}:\t#{DaemonOgre.process_running?(line)}"
502
- end
503
- else
504
- puts "missing pid file (with default path) "+\
505
- "\nif you specificated one manualy pls type"+\
506
- " the path first in with '-p xy/xzt.pid'"
507
- end
508
- DaemonOgre::App.terminate=true
509
- end
510
-
511
- def clear
512
-
513
- logs = ['loh_path','daemon_stderr','exceptions','exlogger']
514
-
515
- logs.each do |logname|
516
- begin
517
- File.delete DaemonOgre::App.__send__(logname)
518
- rescue Exception => ex
519
- puts ex if $DEBUG
520
- end
521
- end
522
-
523
- end
524
-
525
- end
526
- end
527
- end
528
-
529
- end
530
- end
531
-
532
- #monkey patch
533
- begin
534
- def process_running?(input)
535
- DaemonOgre.process_running?(input)
536
- end
537
- def require_directory(directory,*args)
538
- DaemonOgre.load_directory(directory,{:monkey_patch => 1},*args)
539
- end
540
- def require_ymls(directory)
541
- DaemonOgre.load_ymls(
542
- directory,
543
- {:monkey_patch => 1}
544
- )
545
- end
546
- def get_port(port,max_port=65535 ,host="0.0.0.0")
547
- DaemonOgre.get_port(port,max_port,host)
548
- end
549
- def exlogger(error_msg,*args)
550
- arg=Hash[*args]
551
- arg[:prefix] = String.new if arg[:prefix].nil?
552
- arg[:path] = DaemonOgre::App.exlogger if arg[:path].nil?
553
- DaemonOgre.create_on_filesystem arg[:path],
554
- 'a+'
555
- DaemonOgre.error_logger(error_msg,arg[:prefix],arg[:path])
556
- end
557
- class Exception
558
- def logger
559
- DaemonOgre.create_on_filesystem DaemonOgre::App.exceptions,
560
- 'a+'
561
- DaemonOgre.error_logger(self.backtrace,self,DaemonOgre::App.exceptions)
562
- end
563
- end
564
- class File
565
- def self.create!(file,optionable_data=nil,optionable_file_mod="w")
566
- DaemonOgre.create_on_filesystem file,
567
- optionable_file_mod,
568
- optionable_data
569
- end
570
- end
571
- class Class
572
- def class_methods
573
- self.methods - Object.methods
574
- end
575
- def self.class_methods
576
- self.methods - Object.methods
577
- end
578
- end
579
- class Rnd
580
- class << self
581
- def string(length,amount=1)
582
- mrg = String.new
583
- first_string = true
584
- amount.times do
585
- a_string = Random.rand(length)
586
- a_string == 0 ? a_string += 1 : a_string
587
- mrg_prt = (0...a_string).map{ ('a'..'z').to_a[rand(26)] }.join
588
- first_string ? mrg += mrg_prt : mrg+= " #{mrg_prt}"
589
- first_string = false
590
- end
591
- return mrg
592
- end
593
- def integer(length)
594
- Random.rand(length)
595
- end
596
- def boolean
597
- rand(2) == 1
598
- end
599
- def date from = Time.at(1114924812), to = Time.now
600
- rand(from..to)
601
- end
602
- end
603
- end
604
- class Array
605
- def index_of(target_element)
606
- array = self
607
- hash = Hash[array.map.with_index.to_a]
608
- return hash[target_element]
609
- end
610
- end
611
- class Hash
612
- #pass single or array of keys, which will be removed, returning the remaining hash
613
- def remove!(*keys)
614
- keys.each{|key| self.delete(key) }
615
- self
616
- end
617
- #non-destructive version
618
- def remove(*keys)
619
- self.dup.remove!(*keys)
620
- end
621
- end
622
- end
623
-
624
- #StartUp
625
- begin
626
- module DaemonOgre
627
- def self.start(*args)
628
- arg = Hash[*args]
629
-
630
- ##defaults:
631
- #arg[:log_path]
632
- #arg[:pid_path]
633
-
634
- #arg[:name]
635
- #arg[:port]
636
-
637
- #arg[:terminate]
638
- #arg[:clear]
639
-
640
- begin
641
-
642
- begin
643
-
644
- App.pid_path = arg[:pid_path] if !arg[:pid_path].nil?
645
- App.log_path = arg[:log_path] if !arg[:log_path].nil?
646
-
647
- $0 = arg[:name] if !arg[:name].nil?
648
- App.port = arg[:port] if !arg[:port].nil?
649
-
650
- App.terminate = arg[:terminate] if !arg[:terminate].nil?
651
-
652
- end
653
-
654
-
655
- if ARGV.nil?
656
- puts "No server task has been given!"
657
- DaemonOgre::Server.help
658
- end
659
- serv_load = Array.new
660
- ARGV.each do |one_argv_parameter|
661
- case one_argv_parameter.downcase
662
- when "start" then serv_load.push "start"
663
- when "daemon" then serv_load.push "daemon"
664
- when "-d" then DaemonOgre::Server.debug
665
- when "stop" then serv_load.push "stop"
666
- when "restart" then serv_load.push "restart"
667
- when "reset" then serv_load.push "restart"
668
- when "debugger" then serv_load.push "debugger"
669
- when "log" then DaemonOgre::Server.set_log "log"
670
- when "pid" then DaemonOgre::Server.set_pid "pid"
671
- when "-l" then DaemonOgre::Server.set_log "-l"
672
- when "-p" then DaemonOgre::Server.set_pid "-p"
673
- when "port" then DaemonOgre::Server.set_port "port"
674
- when "-tcp" then DaemonOgre::Server.set_port "-tcp"
675
- when "status" then DaemonOgre::Server.pid_check
676
- when "-s" then DaemonOgre::Server.pid_check
677
- when "help" then DaemonOgre::Server.help
678
- when "debug" then DaemonOgre::Server.debug
679
- when "clear" then serv_load.push "clear"
680
-
681
- end
682
- end
683
-
684
- #server_TODO
685
- begin
686
- DaemonOgre::Server.restart if serv_load.include? "restart"
687
- DaemonOgre::Server.start if serv_load.include? "start"
688
- DaemonOgre::Server.stop if serv_load.include? "stop"
689
- DaemonOgre::Server.clear if serv_load.include? "clear"
690
- DaemonOgre::Server.daemon if serv_load.include? "daemon"
691
- end
692
-
693
- #Continue our program ? : )
694
- DaemonOgre::Server.continue? if DaemonOgre::App.terminate
695
-
696
- begin
697
- require "debugger" ;debugger if serv_load.include? "debugger"
698
- rescue Exception => ex
699
- puts "you need to install debugger gem => gem install debugger\n#{ex}"
700
- end
701
-
702
- end
703
- end
704
- def self.help
705
- puts "\n##defaults:\narg[:log_path]\tlog path and"+\
706
- " file name\narg[:pid_path]\tpid path and file n"+\
707
- "ame\narg[:terminate]\tstart command required to"+\
708
- " continue? 'ruby xy.rb start'\narg[:name]\tapplication names as daemon process"
709
- end
710
- end
711
- end
1
+ require File.join File.dirname(__FILE__) , 'daemon-ogre', 'support'
2
+ require File.join File.dirname(__FILE__) , 'daemon-ogre', 'app'
3
+ require File.join File.dirname(__FILE__) , 'daemon-ogre', 'daemon'
4
+ require File.join File.dirname(__FILE__) , 'daemon-ogre', 'server'
5
+ require File.join File.dirname(__FILE__) , 'daemon-ogre', 'mpatch'
6
+ require File.join File.dirname(__FILE__) , 'daemon-ogre', 'startup'