Class: RufusSchedulerWin32::Daemon
- Inherits:
-
Win32::Daemon
- Object
- Win32::Daemon
- RufusSchedulerWin32::Daemon
- Defined in:
- lib/rufus/scheduler/win32/daemon.rb
Overview
Service wrapper around rufus-scheduler
Instance Attribute Summary collapse
Instance Method Summary collapse
- #scheduler ⇒ Object
- #service_main ⇒ Object
- #service_pause ⇒ Object
- #service_resume ⇒ Object
- #service_stop ⇒ Object
Instance Attribute Details
#logger ⇒ Object
48 49 50 |
# File 'lib/rufus/scheduler/win32/daemon.rb', line 48 def logger @logger ||= Logger.new(STDOUT) end |
Instance Method Details
#scheduler ⇒ Object
44 45 46 |
# File 'lib/rufus/scheduler/win32/daemon.rb', line 44 def scheduler @scheduler ||= Rufus::Scheduler.new end |
#service_main ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/rufus/scheduler/win32/daemon.rb', line 11 def service_main logger.info 'Running Main Loop' while scheduler.up? logger.debug 'Still Running' sleep 10 end logger.info 'Scheduler down. Exiting main loop' end |
#service_pause ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/rufus/scheduler/win32/daemon.rb', line 28 def service_pause logger.info 'Pausing scheduler service' scheduler.pause unless scheduler.paused? logger.info 'Paused scheduler service' end |
#service_resume ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/rufus/scheduler/win32/daemon.rb', line 36 def service_resume logger.info 'Resuming scheduler service' scheduler.resume if scheduler.paused? logger.info 'Resumed scheduler service' end |
#service_stop ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/rufus/scheduler/win32/daemon.rb', line 20 def service_stop logger.info 'Stopping scheduler service' scheduler.shutdown(:wait) logger.info 'Service stopped' end |