|
From: Leif M. <le...@ta...> - 2004-07-07 07:47:38
|
Rich, Thanks. I went ahead and implemented this for the 3.1.1 release. I have attached the new template sh script. If anyone has any comments on it I would appreciate hearing them before the release. I did did things a bit differently that the script you sent me. Unless I am missing something, I don't think that there is any reason to change the use user when stopping the Wrapper or requesting a dump. If the user calling the script has the ability to call su, then they will also have the ability to call kill. Setting the user also causes problems when not running as root as it will prompt the user for a password even though the user may already have the privileges necessary to kill the process. This script tests the current user even when running the 'start' command and only uses su if the user would change. This is to avoid a problem where the user will be prompted for a password even when using su to run as themselves. You had mentioned path problems. I think they were being caused by your use of 'su - user -c "cmd"' to launch the Wrapper. That option causes the new cmd to be run in that user's home directory. You can see this by running 'su - user -c "pwd"'. Instread I am using 'su -m user -c "cmd"'. This way the current environment is maintained when running the Wrapper. I could see where this would have drawbacks as well, so it is up to you which one you would rather use. I am leaning toward the later behavior for the default script however. Thanks for the patch, I can actually use this myself, just never got around to writing those few little lines :-) Cheers, Leif Neale, Richard wrote: > Feature Suggestion: > Provide the hooks / example to 'su' to a new user in unix launch of > wrapper. > Typically in a unix boot the user is root, however, many times you need to > be a different user when launching services. To do this, you use 'su' > in the > init.d scripts to become that user. > I have hacked together the elements to do this in the two files; > wrapper.conf and testwrapper > testwrapper is the attached cruisecontrol > wrapper.conf (not attached) required full path definitions which were > easily to discern, however, > I thought exported envvars would be expanded from cruisecontrol > (testwrapper). Must be doing > something wrong here so I have left the full paths in. Maybe the su > masked. > Also note what I did to the kills. > Thoughts ? > Rich |