PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: edjack on August 08, 2019, 01:47:42 PM

Title: Session Check
Post by: edjack on August 08, 2019, 01:47:42 PM
I there a way to check that a pvxplus session is active and if not launch it.
Maybe a background pvx program running continuously or a 3rd party app??
Title: Re: Session Check
Post by: Ben Alexander on August 08, 2019, 03:34:16 PM
I was about to ask the same question.  My old methods are not working now.
Title: Re: Session Check
Post by: Mike King on August 08, 2019, 03:44:50 PM
There isn't really a direct way to to this.

On Windows you could set your Caption to some specific value and then in the other programs use FindWindowA to search for that caption, but that's a Windows only solution.

What I would suggest is to simply create a generic control file and have the processes that you want to check on simply lock/extract specific records.  If you want to see if the process is running just try to access the associated record and if that request fails then the process is running.  Also, should a process die (gracefully or not) the lock will be cleared.

This approach also has the advantage that the control file could in fact be accessed remotely using mapped/mounted drives.
Title: Re: Session Check
Post by: Ben Alexander on August 08, 2019, 03:54:13 PM
I am trying to get an rpc server session running in the background but when I disconnect from the system it dies. Using a crontab entry comes to mind but I do not know what to look for in the ps -ale.