|
From: Leif M. <le...@ta...> - 2006-07-19 07:34:31
|
David, The problem is that the script will first check for a pid file. If it exists, it will look for a process with a matching pid and process name. If found then it knows that process is running. Otherwise, it assumes that the pid file is old. This is required for cases where the system or wrapper crash without cleaning up the pid file. In this case if the wrapepr is running on server A and the script is run on server B, the above test will fail and the pid file will be considered old, causing the wrapper to be launched on server B along with a new pid file being written to disk. This would then cause problems when attempting to stop the app on server A as the pid would no longer be correct there. Cheers, Leif da...@sm... wrote: > But one of the thoughts he had was to create the pid file on a network > accessable directory, so that both machines could use the same > physical location, and thus only one file existing. > > Quoting Leif Mortenson <le...@ta...>: > > >> Martyn, >> You would have to modify the shell script a bit. But you could >> place the pid file >> mentioned in the shell script on the network share. You would have to >> change the >> logic a bit however as the file is currently ignored if the process in >> the pid file does >> not exist. It wouldn't exist on the other machine of course. >> >> Cheers, >> Leif >> >> Martynas Brijunas wrote: >> >>> Hi Leif, >>> >>> thank you for your answer. >>> >>> The processes are started manually by an operator. Or they can be >>> started automatically on one server, and manually on another. So that >>> would eliminate the problem of a power outage you mentioned. >>> >>> I was hoping that by detecting an existing PID file (for example, on a >>> network share), the wrapper would refuse to start on another server, >>> until this original PID file is removed. >>> >>> Martyn >>> >>> >>> 2006/7/10, Leif Mortenson <le...@ta...>: >>> >>> >>>> Martyn, >>>> The problem is that you are talking about two physical machines. >>>> The Wrapper has >>>> features do this within a single machine. But not for multiple >>>> machines. You will need to >>>> implement a startup class which say attempts to open a socket to the >>>> other machine. If >>>> it connects, it knows the other server is running and shuts down. If >>>> it fails to connect then >>>> it can assume it opens its own server socket to listen for connections. >>>> >>>> This is not fail proof however. You need to account for cases where >>>> both servers come >>>> up at pretty much the same instant. Say after a power outage or >>>> something. Maybe make >>>> server a the master. It will always try to run. Server B will try to >>>> start but then poll Server >>>> A and always shutdown if it finds it. Something like that. >>>> >>>> But like was already said, I don't think this is really under the >>>> scope of the wrapper >>>> unless I am missing what you are trying to say. >>>> >>>> Cheers, >>>> Leif >>>> >>>> Martynas Brijunas wrote: >>>> >>>> >>>>> Hi Martin, >>>>> >>>>> thank you for your reply. I think i explained the problem not >>>>> very clearly. >>>>> >>>>> Server A: process AAA is running >>>>> Server B: process AAA must not be running if it is running on Server >>>>> A, otherwise it can. >>>>> >>>>> How to ensure that when it is running on Server A, it cannot be >>>>> started on Server B? And vice versa: when it is running on Server B, >>>>> it cannot be started on Server A. >>>>> >>>>> Is it possible to emply PIDs or anchor files for this purpose? >>>>> >>>>> Thanks, >>>>> Martyn >>>>> >>>>> 2006/7/7, Martin Gazak <ma...@mi...>: >>>>> >>>>> >>>>> >>>>>> Hallo, >>>>>> this seems not to be a task for Java Service Wrapper - try to look for >>>>>> example at www.linux-ha.org (Linux/Unix environment only, but seems to >>>>>> be your case), you may achieve also failover of the service (including >>>>>> the IP failover). >>>>>> >>>>>> >>>>>> >>>>>> Martynas Brijunas wrote: >>>>>> >>>>>> >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> we have 2 servers that have the same wrapper services for failover >>>>>>> reasons. Only one instance of each server can run at any given time. >>>>>>> Is there a way to prevent an accidental start of a service in 2 >>>>>>> locations? I thought of employing a PID file on a network share, but >>>>>>> not sure if that would work. >>>>>>> >>>>>>> Thank you. >>>>>>> >>>>>>> >>>>>>> >> >> ------------------------------------------------------------------------- >> Using Tomcat but need to do more? Need to support web services, security? >> Get stuff done quickly with pre-integrated technology to make your job easier >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> Wrapper-user mailing list >> Wra...@li... >> https://lists.sourceforge.net/lists/listinfo/wrapper-user >> >> > > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Wrapper-user mailing list > Wra...@li... > https://lists.sourceforge.net/lists/listinfo/wrapper-user > > |