Author Topic: REXX - how to kill a process?  (Read 3864 times)

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
REXX - how to kill a process?
« on: November 04, 2020, 05:15:20 pm »
So I need to kill a process given a particular flag being set.

I figured this would be easy in REXX, and most likley would rely on a suitable API call or a built-in function. However, no such thing has been found (REXX newbie here, so take it easy... ;))

But, I did start looking at RXU library, indeed, I can see that I could use:

dosrc = RxQProcStatus(stemname [,flags])

to get the equivalent of PSTAT result.

From there I could fish out the matching record for a particular module (an EXE in my case) and once I have the PID I could call:

killrc = RxKillProcess(pid [, action])

But all this still seems a little convoluted, I mean is there no simpler way to kill a process than having to point to it by a PID? Yes, I understand the reason for this, but if I have a single instantiation of a particular EXE I know that killing it by module name is just fine.

Any suggestions where to look next?

Oh, sure, I could call one of the utilities that do this, but I was hoping to push my REXX "boundaries" a tad and see how this could be implemented, any suggestions?

Thanks!

Doug Bissett

  • Hero Member
  • *****
  • Posts: 1593
  • Karma: +4/-2
    • View Profile
Re: REXX - how to kill a process?
« Reply #1 on: November 04, 2020, 06:55:05 pm »
Try PKILL.EXE. It seems to be included in ArcaOS, and only needs the program name, not a PID.

Remy

  • Hero Member
  • *****
  • Posts: 645
  • Karma: +9/-1
    • View Profile
Re: REXX - how to kill a process?
« Reply #2 on: November 04, 2020, 10:47:43 pm »
So I need to kill a process given a particular flag being set.

I figured this would be easy in REXX, and most likley would rely on a suitable API call or a built-in function. However, no such thing has been found (REXX newbie here, so take it easy... ;))

But, I did start looking at RXU library, indeed, I can see that I could use:

dosrc = RxQProcStatus(stemname [,flags])

to get the equivalent of PSTAT result.

From there I could fish out the matching record for a particular module (an EXE in my case) and once I have the PID I could call:

killrc = RxKillProcess(pid [, action])

But all this still seems a little convoluted, I mean is there no simpler way to kill a process than having to point to it by a PID? Yes, I understand the reason for this, but if I have a single instantiation of a particular EXE I know that killing it by module name is just fine.

Any suggestions where to look next?

Oh, sure, I could call one of the utilities that do this, but I was hoping to push my REXX "boundaries" a tad and see how this could be implemented, any suggestions?

Thanks!

Hi Dariusz,

Check these dlls, very easy to use
http://www.edm2.com/index.php/Category:RxUtilEx
http://www.edm2.com/index.php/Sys2QueryProcess
http://www.edm2.com/index.php/Sys2KillProcess

rxutilex dll doc is available under ArcaOS as well the dll.
Cheers/2
Rémy
« Last Edit: November 06, 2020, 07:51:54 pm by Remy »

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Re: REXX - how to kill a process?
« Reply #3 on: November 05, 2020, 02:11:12 am »

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Re: REXX - how to kill a process?
« Reply #4 on: November 05, 2020, 02:12:21 am »
Hi Doug,

Try PKILL.EXE. It seems to be included in ArcaOS, and only needs the program name, not a PID.

Yup, I got this one on my machine already, but I really wanted to do this through REXX (if anything, it's a bit a learning experience). I'll pursue Remy's suggestion.