Register
It is currently Sat Dec 20, 2014 4:39 am

get pid of java process spawn by su


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Mon Sep 15, 2008 8:18 pm   

Joined: Mon Sep 15, 2008 8:09 pm
Posts: 1
I'm going nuts with this one.

I'm writing an init script for a custom java app. Currently I do the following which gives me the proper pid number.
Code:
${STARTCMD} 2>&1 >> /dev/null &
PID=$!


That works perfectly, except that I need to run it as a non-root user. I've tried several ways, but can't find a way to get a pid (or the right pid).
Code:
su - $USER -c ${STARTCMD} 2>&1 >> /dev/null &   ## returns the pid for the "su" proc.


I should mention that this is for a RHEL5(Centos5) system, so ideally I would like to use the already provided daemon function from /etc/init.d/functions. If I do it this way I need to specify a user and a pid file. That would be fine, but I can't seem to get the syntax right.. At this point I don't care which way I do it, as long as it works and doesn't involve having to write a wrapper script.


Any help would be appreciated. Thanks!


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP