project BLF > class TDaemonUtility > method ProcessIsValidInternal
Parameters
icProcessHostname | input | character | |
iiProcessNR | input | integer | Process number of the process that needs to be checked. |
olValid | output | logical | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program1/tdaemonutility.p)
olValid = ?.
<M-65 run GetHostName (output vcValidateHostname (ocHostName)) in TDaemonUtility>
if vcValidateHostname = icProcessHostname
or vcValidateHostname = ""
or icProcessHostname = ""
then
if OPSYS = "UNIX":U
then do :
/*look if the process id (iiProcessNR) still exists*/
INPUT stream sProcessRead THROUGH
value("ps -p":U + STRING(iiProcessNR) + " >/dev/null 2>&1 ; echo $?").
IMPORT stream sProcessRead vcTemp.
INPUT stream sProcessRead CLOSE.
olValid = vcTemp = "0".
end.
else do:
vhFcComponent = ?.
<M-1 run Main () in Win32Lib>
<M-2 run CheckProcess
(input iiProcessNR (iiProcessId),
output olValid (olValidProcessId),
output oiReturnStatus (oiReturnStatus)) in Win32Lib>
run gipr_DeleteProcedure in vhFcComponent.
delete procedure vhFcComponent.
end.