Sha256: e6565ce534fa2123db070f0d46929ab0c829726e197749a664b8bb584f5e27b4

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

#!/usr/bin/ruby -w
#
# backlog      Startup script for the backlog application
#
# chkconfig: 345 88 12
# description: Backlog

require 'rubygems'
require 'fileutils'

APPLICATION = 'backlog'
GEM = Gem::searcher.find(APPLICATION)
if GEM
  INSTALL_DIR = "/usr/lib/ruby/gems/1.8/gems/#{APPLICATION}-#{Gem.version}"
else
  INSTALL_DIR = "/usr/local/backlog/current"
end

LOG_DIR = "#{INSTALL_DIR}/log"

# See how we were called.
case ARGV[0]
  when 'start':
        Dir.mkdir LOG_DIR unless File.exists? LOG_DIR
    `mongrel_rails start -p 3000 -e production -c #{INSTALL_DIR} -d -m #{INSTALL_DIR}/config/mime_types.yaml 1>#{LOG_DIR}/stdout.log 2>#{LOG_DIR}/stderr.log`
  when 'stop':
    `mongrel_rails stop -c #{INSTALL_DIR}`
  when 'restart':
    puts `mongrel_rails restart -c #{INSTALL_DIR}`
  when 'status'
    puts `ps -ef | grep backlog`
  when 'setup'
    FileUtils.cp "#{INSTALL_DIR}/bin/#{APPLICATION}_init.d", "/etc/init.d/#{APPLICATION}"
    dbs = `su - postgres -c "echo '\\l' | psql postgres"`
    puts dbs
    unless dbs =~ /#{APPLICATION}_production/
      puts `su - postgres -c "createdb #{APPLICATION}_production"`
      Dir.chdir INSTALL_DIR
      puts `rake db:migrate RAILS_ENV=production`
    end
  else
    puts "Usage: #$0 {start|stop|restart|status|setup}"
    exit 1
end

exit 0

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
backlog-0.0.5 bin/backlog