about summary refs log tree commit homepage
path: root/examples/mongrel_simple_ctrl.rb
diff options
context:
space:
mode:
Diffstat (limited to 'examples/mongrel_simple_ctrl.rb')
-rw-r--r--examples/mongrel_simple_ctrl.rb92
1 files changed, 0 insertions, 92 deletions
diff --git a/examples/mongrel_simple_ctrl.rb b/examples/mongrel_simple_ctrl.rb
deleted file mode 100644
index 4663d1c..0000000
--- a/examples/mongrel_simple_ctrl.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-###############################################
-# mongrel_simple_ctrl.rb
-#
-# Control script for the Mongrel server
-###############################################
-require "optparse"
-require "win32/service"
-include Win32
-
-# I start the service name with an 'A' so that it appears at the top
-SERVICE_NAME = "MongrelSvc"
-SERVICE_DISPLAYNAME = "Mongrel HTTP Server"
-SCRIPT_ROOT = File.join(File.dirname(__FILE__), '.')
-SCRIPT_NAME = "mongrel_simple_service.rb"
-SERVICE_SCRIPT = File.expand_path(SCRIPT_ROOT + '/' + SCRIPT_NAME)
-
-OPTIONS = {}
-
-ARGV.options do |opts|
-   opts.on("-d", "--delete", "Delete the service"){ OPTIONS[:delete] = true }
-   opts.on("-u", "--uninstall","Delete the service"){ OPTIONS[:uninstall] = true }
-   opts.on("-s", "--start",  "Start the service"){ OPTIONS[:start] = true }
-   opts.on("-x", "--stop",   "Stop the service"){ OPTIONS[:stop] = true }
-   opts.on("-i", "--install","Install the service"){ OPTIONS[:install] = true }
-
-   opts.on("-h", "--help",   "Show this help message."){ puts opts; exit }
-
-   opts.parse!
-end
-
-# Install the service
-if OPTIONS[:install]  
-   require 'rbconfig'
-  
-   svc = Service.new
-   svc.create_service{ |s|
-      s.service_name     = SERVICE_NAME
-      s.display_name     = SERVICE_DISPLAYNAME
-      s.binary_path_name = Config::CONFIG['bindir'] + '/ruby ' + SERVICE_SCRIPT
-      s.dependencies     = []
-   }
-   svc.close
-   puts "#{SERVICE_DISPLAYNAME} service installed"
-end
-
-# Start the service
-if OPTIONS[:start]
-   Service.start(SERVICE_NAME)
-   started = false
-   while started == false
-      s = Service.status(SERVICE_NAME)
-      started = true if s.current_state == "running"
-      break if started == true
-      puts "One moment, " + s.current_state
-      sleep 1
-   end
-   puts "#{SERVICE_DISPLAYNAME} service started"
-end
-
-# Stop the service
-if OPTIONS[:stop]
-   Service.stop(SERVICE_NAME)
-   stopped = false
-   while stopped == false
-      s = Service.status(SERVICE_NAME)
-      stopped = true if s.current_state == "stopped"
-      break if stopped == true
-      puts "One moment, " + s.current_state
-      sleep 1
-   end
-   puts "#{SERVICE_DISPLAYNAME} service stopped"
-end
-
-# Delete the service.  Stop it first.
-if OPTIONS[:delete] || OPTIONS[:uninstall]
-   begin
-      Service.stop(SERVICE_NAME)
-   rescue
-   end
-   begin
-    Service.delete(SERVICE_NAME)
-   rescue
-   end
-   puts "#{SERVICE_DISPLAYNAME} service deleted"
-end
-# END mongrel_rails_ctrl.rb
-
-
-
-
-
-