#!/usr/bin/env ruby
app_dir = '/srv/www'
apps = {
'ladybird' => 8001
}
if ['stop', 'restart'].include? ARGV.first
apps.each do |path, port|
path = File.join app_dir, path
puts "Stopping #{path}..."
`mongrel_rails stop -c #{path}/current -P log/mongrel.pid`
end
end
if ['start', 'restart'].include? ARGV.first
apps.each do |path, port|
path = File.join app_dir, path
puts "Starting #{path} on #{port}..."
`mongrel_rails start -d -p #{port} -e production -c #{path}/current -P log/mongrel.pid`
end
end
unless ['start', 'stop', 'restart'].include? ARGV.first
puts "Usage: mongrel {start|stop|restart}"
exit
end