Skip to main content

How to see if a program is running.

  • January 29, 2024
  • 5 replies
  • 0 views

I am using a windows based universe system.  I want to be able to do a listu type of command to see if a certain program is already running so that I can parse it in a basic program.  I saw the LISTUSER command, but that only shows the account path and not the program that is running.  I also saw the port.status command, but that is not installed on this system.  Can you please advise on how to do this?



------------------------------
Troy Dittberner
President
Northstar Data Services Inc
Brooklyn Park VA US
------------------------------

5 replies

Forum|alt.badge.img
  • Participating Frequently
  • 12 replies
  • January 29, 2024

I am using a windows based universe system.  I want to be able to do a listu type of command to see if a certain program is already running so that I can parse it in a basic program.  I saw the LISTUSER command, but that only shows the account path and not the program that is running.  I also saw the port.status command, but that is not installed on this system.  Can you please advise on how to do this?



------------------------------
Troy Dittberner
President
Northstar Data Services Inc
Brooklyn Park VA US
------------------------------

Log to your UV account and in the VOC you should see the PORT.STATUS command there.  You can create the same VOC item in your working account.



------------------------------
Greg Livingston
Universe Practice Lead
OUTsurance Insurance
Centurion GA ZA
------------------------------

  • Author
  • Participating Frequently
  • 10 replies
  • January 29, 2024

Log to your UV account and in the VOC you should see the PORT.STATUS command there.  You can create the same VOC item in your working account.



------------------------------
Greg Livingston
Universe Practice Lead
OUTsurance Insurance
Centurion GA ZA
------------------------------

That worked, but the phantom port that I started the program on is showing unavailable and not the program name that I ran.  Is there a way to see that?



------------------------------
Troy Dittberner
President
Northstar Data Services Inc
Brooklyn Park VA US
------------------------------

John Jenkins
Forum|alt.badge.img+1
  • Participating Frequently
  • 253 replies
  • January 29, 2024

I am using a windows based universe system.  I want to be able to do a listu type of command to see if a certain program is already running so that I can parse it in a basic program.  I saw the LISTUSER command, but that only shows the account path and not the program that is running.  I also saw the port.status command, but that is not installed on this system.  Can you please advise on how to do this?



------------------------------
Troy Dittberner
President
Northstar Data Services Inc
Brooklyn Park VA US
------------------------------

Troy,

Take a look at PORT.STATUS:

PORT.STATUS [USER name] [PORT number] [DEVICE pathname] [PID process#]
[FILEMAP] [LAYER.STACK] [MFILE.HIST] [LOCK.HIST] [{ENABLE | DISABLE}
LOCK.HIST] [ODBC.CONNECTIONS] [LPTR] [RUNNING] [SUSPENDED]


The PORT.STATUS command with no options produces a report that looks like this:

>PORT.STATUS
There are currently 5 UniVerse sessions; 5 interactive, 0 phantom
Pid.. User name. Who Port name.. Last command processed...........
6002 walter 13 /dev/ttyp2 PORT.STATUS
5047 cac 16 /dev/ttyp8 LIST CONTACTS <<I2,Enter vendor id>>
5812 barbara 26 /dev/ttypd SELECT IB WITH DESC LIKE '...LOCATE...'
5844 tamara 47 /dev/ttyq8 LIST IB LONG.DESC FIXED.AT.ANY

As a technique you could also add a BASIC lock to a specific program - e.g. LOCK 1. This is a system semaphore lock and can be tested by other programs - viz: LOCK 1 ELSE... If the lock is not set then the program is not running.

Regards

JJ



------------------------------
John Jenkins
Thame, Oxfordshire
------------------------------

  • Author
  • Participating Frequently
  • 10 replies
  • January 29, 2024

That worked, but the phantom port that I started the program on is showing unavailable and not the program name that I ran.  Is there a way to see that?



------------------------------
Troy Dittberner
President
Northstar Data Services Inc
Brooklyn Park VA US
------------------------------

What I am trying to do is to create a process that will start a program as a phantom if it is not already running so that it does not get started again.  Tell me if this would work.  If I added a line of code to the program that I want to run in a phantom that locked a record in a control file and then check for that record lock and if it is locked, that would mean the process is already running.  If it get's killed for some reason, the lock would automatically be released, correct?



------------------------------
Troy Dittberner
President
Northstar Data Services Inc
Brooklyn Park VA US
------------------------------

Forum|alt.badge.img
  • Participating Frequently
  • 12 replies
  • January 29, 2024

What I am trying to do is to create a process that will start a program as a phantom if it is not already running so that it does not get started again.  Tell me if this would work.  If I added a line of code to the program that I want to run in a phantom that locked a record in a control file and then check for that record lock and if it is locked, that would mean the process is already running.  If it get's killed for some reason, the lock would automatically be released, correct?



------------------------------
Troy Dittberner
President
Northstar Data Services Inc
Brooklyn Park VA US
------------------------------

Your logic sounds correct to control the number of processes running at a time.  The release of the lock as result of a process being killed is not guaranteed but majority of the cases it would.

You could also check the LOCK command, but that lock will not be released on a semaphore lock unless it is explicitly released by a corresponding UNLOCK command. Even if the process is  terminated.



------------------------------
Greg Livingston
Universe Practice Lead
OUTsurance Insurance
Centurion GA ZA
------------------------------