Sha256: 6faa4a3363feb6a2fa84802be2d509c145128b2d80001db0ec0e1bc0bfbefb6e
Contents?: true
Size: 2 KB
Versions: 7
Compression:
Stored size: 2 KB
Contents
#!/usr/bin/ruby -w # # backlog Startup script for the backlog application # # chkconfig: 345 88 12 # description: Backlog require 'rubygems' require 'fileutils' require 'ftools' require 'yaml' APPLICATION = 'backlog' if gem = Gem::searcher.find(APPLICATION) INSTALL_DIR = "/usr/lib/ruby/gems/1.8/gems/#{APPLICATION}-#{gem.version}" else INSTALL_DIR = "/usr/local/backlog/current" end config_file = '/etc/backlog.conf' config = {} config = File.open(config_file) {|f| YAML::load(f)} if File.exists? config_file LOG_DIR = "#{INSTALL_DIR}/log" PID_FILE = '/var/run/backlog.pid' # See how we were called. case ARGV[0] when 'start': File.makedirs LOG_DIR unless File.exists? LOG_DIR File.makedirs File.dirname(PID_FILE) unless File.exists? File.dirname(PID_FILE) `mongrel_rails start -p #{config['port'] || 3000} -e production -c #{INSTALL_DIR} -d -m #{INSTALL_DIR}/config/mime_types.yaml -P #{PID_FILE} 1>#{LOG_DIR}/stdout.log 2>#{LOG_DIR}/stderr.log` when 'stop': `mongrel_rails stop -c #{INSTALL_DIR} -P #{PID_FILE}` when 'restart': puts `mongrel_rails restart -c #{INSTALL_DIR} -P #{PID_FILE}` when 'status' puts `ps -ef | grep backlog` when 'setup_linux' current_user = `whoami` users = `su - postgres -c "echo '\\du' | psql template1"` puts users unless users =~ /root/ puts `su - postgres -c "createuser -dA #{current_user}"` end dbs = `su - postgres -c "echo '\\l' | psql template1"` puts dbs unless dbs =~ /#{APPLICATION}_production/ puts `su - postgres -c "createdb #{APPLICATION}_production"` end Dir.chdir INSTALL_DIR Dir.mkdir LOG_DIR unless File.exists? LOG_DIR puts `rake db:migrate RAILS_ENV=production` startup_app = "/etc/init.d/#{APPLICATION}" `ln -s /usr/bin/#{APPLICATION} #{startup_app}` unless File.exists? startup_app FileUtils.cp "#{INSTALL_DIR}/etc/#{APPLICATION}.conf", config_file unless File.exists? config_file else puts "Usage: #$0 {start|stop|restart|status|setup}" exit 1 end exit 0
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
backlog-0.3.8 | bin/backlog |
backlog-0.3.9 | bin/backlog |
backlog-0.4.0 | bin/backlog |
backlog-0.5.0 | bin/backlog |
backlog-0.5.1 | bin/backlog |
backlog-0.5.2 | bin/backlog |
backlog-0.5.3 | bin/backlog |