#!/usr/bin/env ruby # == thin # Script to launch a Thin server for a Rails application. # # To start a server for your current Rails app: # thin start # You can specify the port using the -p option: # thin start -p3001 # By default the server will bind to 0.0.0.0:3000 # # You can specify which Rails environment should be loaded with the -e option: # thin start -e production # # You can also start the server in daemon mode: # thin start -d # And later stop it # thin stop # # Run thin help to get help. require File.dirname(__FILE__) + '/../lib/thin' require 'thin/command' Thin.define_commands do program_name 'thin' version Thin::VERSION::STRING help 'Thin is a web server that can run your Rails app in no time' option :address, :short => :a, :default => '0.0.0.0', :message => 'Address to bind to', :param_name => 'ADDRESS' option :port, :short => :p, :default => 3000, :message => 'Port number to bind to', :param_name => 'PORT', :type => :int option :environment, :short => :e, :default => 'development', :message => 'Rails environment', :param_name => 'ENVIRONMENT' option :log_file, :short => :l, :default => 'log/thin.log', :message => 'File to write log output to (use with -d)', :param_name => 'PATH' option :pid_file, :short => :P, :default => 'tmp/pids/thin.pid', :message => 'File to write the PID (use with -d)', :param_name => 'PATH' option :daemonize, :short => :d, :message => 'Run in the background' option :user, :short => :u, :param_name => 'USER', :message => 'User to run the process as' option :group, :short => :g, :param_name => 'GROUP', :message => 'Group to run the process as' option :timeout, :short => :T, :param_name => 'SEC', :message => 'Server timeout before giving up', :default => 60 option :trace, :short => :t, :message => 'Turn trace on' command :start, Thin::Commands::Server::Start, :valid_options => [:address, :port, :environment, :log_file, :daemonize, :pid_file, :user, :group, :trace, :timeout] command :stop, Thin::Commands::Server::Stop, :valid_options => [:pid_file, :timeout] end