I agree. It's making assumptions like this that caused the problem in the first place (origional assumption being phoenix.pid exists means it's running....)
I think my assumption of it running if there's a process under the recorded id (small chance of it being somthing else) and having "phoenix.home" in it (very very small chance of it being somthing else). This is the fist bit of shell script i've ever written, and i'm amazed it works... >> (should it not be phoenix\.home really) Why? (i'm new to this!) is it just escaping? or somthing else? >>Sounds as if you down have it registered to be stopped during shutdown. Ok, that was my guess... But again, being new to this, how do you do that? I thought having it registered as a service, it would be done for me... [EMAIL PROTECTED] root]# chkconfig --list | grep james james 0:off 1:off 2:off 3:on 4:on 5:on 6:off I thought that meant it would be be turned off for halt (0) and reboot (6). Correct me if i'm wrong :) Daniel. -----Original Message----- From: Christian Andersson [mailto:[EMAIL PROTECTED] Sent: 04 March 2004 06:35 To: James Users List Subject: Re: Checking PHOENIX_PID for validity I only see one problem with the one that is in CVS compared to the one that was offered. The CVS one does not take in account that linux reuses the process numbers, and therefore there can be some other process that use the same pid, the one offered tries to take this into account with the usage of grep phoenix.home (should it not be phoenix\.home really) Especially if the main problem is after a unclean shutdown of the james server and then an reboot of the machine this would be the case. I have some time ago downloaded a shell script some time ago that was designed to be used for the init.d (with start,stop,restart,status, etc) This script has the same problem, and I was baffled before I discovered it why my servers would not start at a reboot. I ended up having to code in not just checking that the process was living,but that it was a java process that had some parameters that identified it as my server. /Christian Niclas Hedhman wrote: > On Thursday 04 March 2004 08:46, Noel J. Bergman wrote: > >>> if [ -f $PHOENIX_PID ] >>> then >>> phpid=`cat $PHOENIX_PID 2>/dev/null` >>> piddata=`ps $phpid | grep phoenix.home 2>/dev/null` >>> if [ "$piddata" != "" ] >>> then >>> echo "Already Running!!" >>> exit 1 >>> fi >>> fi >>> >>>Not sure wether the phoenix team would be interested in doing somthing >>>similar so as to avoid this kind of problem! >> >>I'll cc the Avalon folks so that they can consider it. > > > > This is already present in Phoenix, at least what is in the CVS. > > start) > echo "Starting Phoenix: " > > if [ -f $PHOENIX_PID ] > then > if ps -p `cat $PHOENIX_PID ` >/dev/null 2>/dev/null > then > echo "Already Running!!" > exit 1 > fi > fi > > > Cheers > Niclas --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
