Added rubycas-server-ctl (start|stop|restart); added -P, --pid_file FILE option to rubycas-server; added pid file creation/removal to postambles.rb
git-svn-id: https://rubycas-server.googlecode.com/svn/trunk@90 fffcb96a-a727-0410-ad3e-7b35c796b8d7
This commit is contained in:
Родитель
a816cae8eb
Коммит
96a1482260
|
@ -21,7 +21,19 @@ OptionParser.new do |opts|
|
|||
opts.on("-d", "--daemonize", "Run as a daemon (only when using webrick or mongrel)") do |c|
|
||||
$DAEMONIZE = true
|
||||
end
|
||||
|
||||
|
||||
opts.on("-P", "--pid_file FILE", "Use pid file (default is /etc/rubycas-server/rubycas-server.pid)") do |c|
|
||||
if $DAEMONIZE && !File.exists?(c)
|
||||
puts "Using pid file #{c}"
|
||||
$PID_FILE = c
|
||||
elsif File.exists?(c)
|
||||
puts "The pid file already exists. Is rubycas-server running?"
|
||||
exit
|
||||
else
|
||||
puts "Not running as Daemon. Ignoring pid option"
|
||||
end
|
||||
end
|
||||
|
||||
opts.on_tail("-h", "--help", "Show this message") do
|
||||
puts opts
|
||||
exit
|
||||
|
@ -36,4 +48,4 @@ end.parse!
|
|||
|
||||
$RUN = true
|
||||
|
||||
load 'casserver.rb'
|
||||
load 'casserver.rb'
|
||||
|
|
|
@ -88,9 +88,18 @@ module CASServer
|
|||
|
||||
CASServer.init_logger
|
||||
CASServer.init_db_logger
|
||||
|
||||
if $DAEMONIZE && $PID_FILE
|
||||
open($PID_FILE, "w") { |file| file.write(Process.pid) }
|
||||
end
|
||||
|
||||
puts "\n** CASServer is running at http://localhost:#{CASServer::Conf.port}#{CASServer::Conf.uri_path} and logging to '#{CASServer::Conf.log[:file]}'"
|
||||
config.join
|
||||
|
||||
if $PID_FILE && File.exists?($PID_FILE)
|
||||
File.unlink $PID_FILE
|
||||
end
|
||||
|
||||
puts "\n** CASServer is stopped (#{Time.now})"
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче