|
From: Maxime A. <max...@ta...> - 2018-09-12 02:16:32
|
Etienne Sorry, I was mistaken. It is possible to change the group if your user is the owner of the file and also belong to the group. However there is currently no configuration properties to change the group for now. This is something that we will add in a future version, similar to the umask properties. In the meantime, I can suggest you the following workaround even though it is not straightforward: When the Wrapper starts and whenever the log file changes, a notification is sent to the JVM. In response, the WrapperManager will raise a Java event which you could subscribe to. For this you need to have a class that implements the WrapperEventListener interface. Basically you need to have a fired() method which receives a WrapperEvent instance, check that this instance is of type WrapperLogFileChangedEvent, and then execute your code to change the group of the log file. If you use the professional edition, you can trigger a User event from the Java code and execute a shell script in response which would update the group of the log file whenever it changes. Alternatively, you could also use timers to regularly ensure that the log file has the correct group and update it if needed. Please let me know if you need further details on one of the above methods. Best Regards, Maxime On Wed, Sep 12, 2018 at 9:16 AM, Maxime Andrighetto < max...@ta...> wrote: > Etienne > > Thank you for your reply. > > Unfortunately it is not possible to change the group of the log file > without having the root/sudo permission. > So this is not possible when the Wrapper is running with the jenkins user. > > You will have to edit the ownership of your file with a linux command or > manually, using the root user. > > Best Regards, > > Maxime > > On Tue, Sep 11, 2018 at 7:37 PM, Etienne Jouvin <lap...@gm...> > wrote: > >> Hello. >> >> In fact, I am using Wrapper with the projet Jenkins Runner: >> https://github.com/mnadeem/JenkinsRunner >> >> The service is run as a specific user, let's say "jenkins". >> >> As I am using it under "Ubuntu", I wanted to centralize logs as it is >> done. >> So I created a folder /var/log/jenkins, and logs are created with name >> like jenkins.log. >> >> What I wanted, is to have permissions for owner jenkins, and group adm, >> as if I did something like this : >> mkdir /var/log/jenkins >> chown jenkins:adm /var/log/jenkins >> >> But when log files are created, the ownership is something like >> jenkins:jenkins. Group may comes from the default group for user jenkins. >> But I do not want to put user jenkins in group adm by default, because this >> is not an administrator. >> >> So in fact, this is not a matter of changing the owner (my bad for the >> description), but more changing the group. >> >> If not possible, I will find a way to do it with configuration on the >> LInux system. >> >> Regards >> >> Etienne Jouvin >> >> >> >> Le mar. 11 sept. 2018 à 04:17, Maxime <ma...@ta...> a >> écrit : >> >>> Etienne >>> >>> Thank you for your email. >>> >>> Are you running the Wrapper as root? >>> The Wrapper can change the permissions of the log file because it is >>> owner of it, but it cannot change the ownership (this would require running >>> itself as root anyway). >>> The Wrapper creates the log file, writes in it and rolls it if needed, >>> so usually the user of the Wrapper process is also the owner of the log >>> file. >>> For this reason there is currently no property to change the owner of >>> the log file. >>> >>> May I ask the use case in which you need to have the owner of the log >>> file different than the user of the Wrapper? >>> >>> Best Regards, >>> >>> Maxime >>> >>> >>> >>> >> >> _______________________________________________ >> Wrapper-user mailing list >> Wra...@li... >> https://lists.sourceforge.net/lists/listinfo/wrapper-user >> >> > > > -- > Maxime Andrighetto > Tanuki Software Ltd. > 6-18-10-4F Nishi-Kasai, Edogawa-ku > Tokyo 134-0088 Japan > Tel: +81-3-3878-3211 > Fax: +81-3-3878-0313 > http://www.tanukisoftware.com > -- Maxime Andrighetto Tanuki Software Ltd. 6-18-10-4F Nishi-Kasai, Edogawa-ku Tokyo 134-0088 Japan Tel: +81-3-3878-3211 Fax: +81-3-3878-0313 http://www.tanukisoftware.com |