lib/process/daemon/controller.rb in process-daemon-0.1.0 vs lib/process/daemon/controller.rb in process-daemon-0.3.0
- old
+ new
@@ -27,27 +27,27 @@
# This module contains functionality related to starting and stopping the daemon, and code for processing command line input.
module Controller
# This function is called from the daemon executable. It processes ARGV and checks whether the user is asking for `start`, `stop`, `restart`, `status`.
def self.daemonize(daemon, argv = ARGV)
- case argv.shift
- when 'start'
+ case argv.shift.to_sym
+ when :start
start(daemon)
status(daemon)
- when 'stop'
+ when :stop
stop(daemon)
status(daemon)
ProcessFile.cleanup(daemon)
- when 'restart'
+ when :restart
stop(daemon)
ProcessFile.cleanup(daemon)
start(daemon)
status(daemon)
- when 'status'
+ when :status
status(daemon)
else
puts "Invalid command. Please specify start, restart, stop or status."
- exit
+ exit 1
end
end
# This function starts the supplied daemon
def self.start(daemon)