mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Fixed up messages for win32 related to signals. Applied Bradley Taylor's user:group patch v2.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@204 19e92222-5c0b-0410-8929-a290d50e31e9
This commit is contained in:
parent
c45b6f077e
commit
3843f96fb4
3 changed files with 11 additions and 10 deletions
|
@ -36,8 +36,8 @@ class Start < GemPlugin::Plugin "/commands"
|
|||
['-C', '--config PATH', "Use a config file", :@config_file, nil],
|
||||
['-S', '--script PATH', "Load the given file as an extra config script.", :@config_script, nil],
|
||||
['-G', '--generate CONFIG', "Generate a config file for -C", :@generate, nil],
|
||||
['-u', '--user USER', "User to run as", :@user, nil],
|
||||
['-g', '--group GROUP', "Group to run as", :@group, nil]
|
||||
['', '--user USER', "User to run as", :@user, nil],
|
||||
['', '--group GROUP', "Group to run as", :@group, nil]
|
||||
]
|
||||
end
|
||||
|
||||
|
@ -62,6 +62,7 @@ class Start < GemPlugin::Plugin "/commands"
|
|||
|
||||
def valid_user?(user)
|
||||
valid?(Process.uid == 0, "You must be root to change the user.")
|
||||
valid?(@group, "You must also specify a group.")
|
||||
begin
|
||||
Etc.getpwnam(user)
|
||||
rescue
|
||||
|
@ -72,6 +73,7 @@ class Start < GemPlugin::Plugin "/commands"
|
|||
|
||||
def valid_group?(group)
|
||||
valid?(Process.uid == 0, "You must be root to change the group.")
|
||||
valid?(@user, "You must also specify a user.")
|
||||
begin
|
||||
Etc.getgrnam(group)
|
||||
rescue
|
||||
|
@ -140,6 +142,7 @@ class Start < GemPlugin::Plugin "/commands"
|
|||
|
||||
config.run
|
||||
config.log "Mongrel available at #{settings[:host]}:#{settings[:port]}"
|
||||
config.log "Use CTRL-C to stop." if not @daemon
|
||||
config.join
|
||||
|
||||
if config.needs_restart
|
||||
|
|
|
@ -15,9 +15,7 @@ pre-compiled gems available for people to use.
|
|||
|
||||
h2. Stopping The mongrel_rails Script
|
||||
|
||||
When you run the mongrel_rails script from the command line you'll have to use *CTRL-Pause/Break*
|
||||
to get it to exit rather than CTRL-C.
|
||||
|
||||
Just like in POSIX systems, you use CTRL-C to exit the mongrel_rails script.
|
||||
|
||||
h2. Running The Service
|
||||
|
||||
|
|
|
@ -721,14 +721,14 @@ module Mongrel
|
|||
|
||||
# Change privilege of the process to specified user and group.
|
||||
def change_privilege(user, group)
|
||||
if user
|
||||
log "Changing user to #{user}."
|
||||
Process::UID.change_privilege(Etc.getpwnam(user).uid)
|
||||
end
|
||||
if group
|
||||
log "Changing group to #{group}."
|
||||
Process::GID.change_privilege(Etc.getgrnam(group).gid)
|
||||
end
|
||||
if user
|
||||
log "Changing user to #{user}."
|
||||
Process::UID.change_privilege(Etc.getpwnam(user).uid)
|
||||
end
|
||||
end
|
||||
|
||||
# generates a class for cloaking the current self and making the DSL nicer
|
||||
|
@ -989,7 +989,7 @@ module Mongrel
|
|||
|
||||
log "Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart)."
|
||||
else
|
||||
log "WARNING: Win32 does not have signals support."
|
||||
log "Signals ready. INT => stop (no restart)."
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue