Sha256: a2863ab495a4e94f01692ccfc75b3f20621f003f17b72321eeef3687ef030d17

Contents?: true

Size: 854 Bytes

Versions: 31

Compression:

Stored size: 854 Bytes

Contents

#!/usr/bin/env ruby

user = "<%=user%>"
port = "<%=port%>"
path = "<%=path%>"
pid = "mongrel.pid"

ENV["PATH"] = "%s/bin:%s" % [`gem env gemdir`.strip, ENV["PATH"]]

case ARGV.first
when "start"
  Dir.chdir(path)
  puts "Starting MyAppServer at http://localhost:#{port}/"
  exit system("PATH=#{ENV["PATH"]} mongrel_rails start " \
    "--user #{user} --group #{user} --pid #{pid} --daemonize " \
    "--port #{port} 2>&1 | grep -v cgi_multipart_eof_fix") ? 0 : 1
when "stop"
  Dir.chdir(path)
  exit system("PATH=#{ENV["PATH"]} mongrel_rails stop " \
    "--pid #{pid} 2>&1 | grep -v cgi_multipart_eof_fix") ? 0 : 1
when "status"
  begin
    Process.kill(0, File.read(File.join(path, pid)).to_i)
    exit 0
  rescue Errno::ENOENT, Errno::ESRCH
    exit -1 # File or pid not found
  end
else
  puts "ERROR: expected argument -- start, stop or status"
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
automate-it-0.9.2 examples/basic/dist/myapp_server.erb
automate-it-0.9.1 examples/basic/dist/myapp_server.erb
automate-it-0.9.0 examples/basic/dist/myapp_server.erb
automateit-0.71003 examples/basic/dist/myapp_server.erb
automateit-0.70923 examples/basic/dist/myapp_server.erb
automateit-0.70928 examples/basic/dist/myapp_server.erb
automateit-0.70930 examples/basic/dist/myapp_server.erb
automateit-0.71012 examples/basic/dist/myapp_server.erb
automateit-0.71017 examples/basic/dist/myapp_server.erb
automateit-0.71021 examples/basic/dist/myapp_server.erb
automateit-0.71030 examples/basic/dist/myapp_server.erb
automateit-0.71006 examples/basic/dist/myapp_server.erb
automateit-0.71031.1 examples/basic/dist/myapp_server.erb
automateit-0.71031.2 examples/basic/dist/myapp_server.erb
automateit-0.71031 examples/basic/dist/myapp_server.erb
automateit-0.71101 examples/basic/dist/myapp_server.erb
automateit-0.71101.2 examples/basic/dist/myapp_server.erb
automateit-0.71102 examples/basic/dist/myapp_server.erb
automateit-0.71103 examples/basic/dist/myapp_server.erb
automateit-0.71101.1 examples/basic/dist/myapp_server.erb