FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 10-06-2010, 10:29 AM
Friedrich Clausen
 
Default Daemontools question.

Hi All,

I am trying to run some Java programs under daemontools and it is
working quite well. Except they are running as root and I would like
to make them run as www-data. I found the daemontools "setuidgid"
program which works for well for starting up the application but then
daemontools cannot shut the application down again. Here is an example
of the daemontools run job -

#!/bin/bash
# /etc/service/myapplication/run startup script
source /etc/default/myapplication
exec setuidgid www-data java -jar /opt/webapps/myapplication.jar
--port 9000 --headless >> /opt/logs/myapplication.log 2>&1

when I leave out the setuidgid stuff then I am able to start and stop
the application. But with the above example the shutdown signal does
not seem to reach the Java process even though I am using exec.

Any hints will be much appreciated!

Thanks,

Fred.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: AANLkTin2zgH5wjMfBPJB+tccarboc-vypWz6ZV1Fmoiv@mail.gmail.com">http://lists.debian.org/AANLkTin2zgH5wjMfBPJB+tccarboc-vypWz6ZV1Fmoiv@mail.gmail.com
 
Old 10-06-2010, 11:32 AM
"Karl E. Jorgensen"
 
Default Daemontools question.

On Wed, 2010-10-06 at 12:29 +0200, Friedrich Clausen wrote:


Hi All,

I am trying to run some Java programs under daemontools and it is
working quite well. Except they are running as root and I would like
to make them run as www-data. I found the daemontools "setuidgid"
program which works for well for starting up the application but then
daemontools cannot shut the application down again. Here is an example
of the daemontools run job -

#!/bin/bash
# /etc/service/myapplication/run startup script
source /etc/default/myapplication
exec setuidgid www-data java -jar /opt/webapps/myapplication.jar
--port 9000 --headless >> /opt/logs/myapplication.log 2>&1



You may want to look into jsvc - this has some similar capabilities. For example, have a look at the init script for tomcat - this should be a good template





when I leave out the setuidgid stuff then I am able to start and stop
the application. But with the above example the shutdown signal does
not seem to reach the Java process even though I am using exec.




Java processes tend to be a bit nasty here: e.g. tomcat is intended to shut down when told (nicely) to shut down - by receipt of a message. But if it is wedged, then it will not reply and needs to be killed. Again, the init script for tomcat should be instructive here.



Hope this helps




--

Karl E. Jørgensen

Geek
 
Old 10-06-2010, 12:07 PM
Friedrich Clausen
 
Default Daemontools question.

On Wed, Oct 6, 2010 at 1:32 PM, Karl E. Jorgensen <karl@fizzback.net> wrote


You may want to look into jsvc - this has some similar capabilities. For example, have a look at the init script for tomcat - this should be a good template
Thanks for the information - I have already looked into jsvc and, while it will work, the corporate standard here for all the servers running our own applications is daemontools so I am*hesitant*to create an "oddball" collection of servers.*

But I will certainly be considering jsvc in the future.


Java processes tend to be a bit nasty here: e.g. tomcat is intended to shut down when told (nicely) to shut down - by receipt of a message. But if it is wedged, then it will not reply and needs to be killed. Again, the init script for tomcat should be instructive here.




Hope this helps

Usually our apps shutdown OK but there have, indeed, been instances where they needed to be shutdown more forcefully.
Cheers,

Fred.
 

Thread Tools




All times are GMT. The time now is 07:10 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org