In my opinion, the best way to do it from RPG would be to use a tool like UNIXCMD:
https://www.scottklement.com/unixcmd/


This is off the top of my head and untested, but i'd do something like this with UNIXCMD:

**FREE
dcl-f UNIX disk(132) handler('UNIXCMDOA': cmd) usropn;

dcl-s cmd char(5000);
dcl-ds record len(132) end-ds;
dcl-s inst char(10) dim(2);

dcl-pr QCMDEXC extpgm('QSYS/QCMDEXC');
cmd char(5000) const;
length packed(15: 5) const;
igc char(3) const options(*nopass);
endpr;


cmd = '/QIBM/ProdData/OS/WebServices/bin/listWebServicesServers.sh';
open UNIX;

read UNIX record;
dow not %eof(UNIX);

if %scan('running': record) = 0;
inst = %split(record:' ');
cmd = 'STRTCPSVR *HTTP HTTPSVR(' + %trim(inst(1)) + ')';
QCMDEXC(cmd: %len(cmd));
endif;

read UNIX record;
enddo;

close UNIX;
*inlr = *on;


If you can't use a tool like this, then you have to write the output from QSH to a temporary file, and read the file. Or learn how to use the pipe and spawn APIs.

-SK


On 8/19/22 1:01 AM, Don Brown wrote:
Preferably ILE RPG

But if there is a reference for other options then I am always keen to learn more.

I just need a utility that will check if a web service is started and if not start it that can be automated.

Thanks

Don





From: "Scott Klement" <midrange-l@xxxxxxxxxxxxxxxx>
To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: "Don Brown" <DBrown@xxxxxxxxxx>
Date: 19/08/2022 03:56 PM
Subject: Re: Checking if a web server service is running from green screen
------------------------------------------------------------------------



In what language?  QShell?

On 8/19/22 12:45 AM, Don Brown via MIDRANGE-L wrote:
Thanks Bryan,

I ran the QSH
CMD('/QIBM/ProdData/OS/WebServices/bin/listWebServicesServers.sh')

and the result

WSERVICE01 (Running)
Press ENTER to end terminal session.

How do I receive this result so I can interrogate and take an action based
on the result ?

Thanks





---

This email has been scanned for computer viruses. Although MSD has taken reasonable precautions to ensure no viruses are present in this email, MSD cannot accept responsibility for any loss or damage arising from the use of this email or attachments.^_sb




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.