Sha256: 968109157eda6eb03220115b523cf4415112805c023f76175ad5dd864cc909e9

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

#!/usr/bin/env ruby

# Libs and init
require "thin"
APP_ROOT = File.dirname(__FILE__) + '/../'
DEVELOPMENT = ARGV.include?("development")

# Include config file and build rack commandline
require File.expand_path("#{APP_ROOT}/lib/rest-ftp-daemon/config.rb")
argv = ARGV
argv << ["-p", Settings.port.to_s] unless ARGV.include?("-p") || Settings.port.nil?
argv << ["-e", Settings.namespace] unless ARGV.include?("-e") || Settings.namespace.nil?
argv << ["-l", Settings.logs.thin] unless ARGV.include?("-l") unless Settings.logs.thin.nil? unless Settings.logs.nil?
argv << ["--daemonize"] if (Settings.daemonize==1 || Settings.daemonize.nil?) unless ARGV.include?("-d")

# Rackup file
argv << ["-R", File.expand_path("#{APP_ROOT}/config.ru")] unless ARGV.include?("-R")

# Display compiled configuration
puts
puts "Daemon name \t #{Settings.name}"
puts "Version     \t #{Settings.version}"
puts "Environment \t #{Settings.namespace}"
puts "Config file \t #{Settings.source}"
puts "Parameters  \t #{argv.flatten}"
puts Settings.to_hash.to_yaml( :Indent => 4, :UseHeader => true, :UseVersion => false )

# Start Thin with this rackup configuration
puts
begin
  Thin::Runner.new(argv.flatten).run!
rescue Thin::PidFileExist
  puts "EXITING: daemon was already running (Thin::PidFileExist)"
rescue Thin::PidFileNotFound
  puts "EXITING: daemon was not running (Thin::PidFileNotFound)"
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rest-ftp-daemon-0.55 bin/rest-ftp-daemon