#pid(), #procid(), #processid()
DESCRIPTION
returns the process id (pid) of a given process
SYNOPSIS
#pid(s)
#procid(s)
#processid(s)
ARGUMENTS
s - a string, or string expression, representing a process name
EXAMPLES
# pikt +C 'output $text(#pid("pikt"))'
19258
rule
if #processid($pr1) == #nil()
set #norun = #true()
set $state = "-"
endif
// check pid's
if #pid("piktc_svc") == #nil()
output mail "piktc_svc not running!"
fi
if #pid("piktc_svc") == #err()
output mail "multiple piktc_svc running!"
fi
if #pid("piktd") == #nil()
output mail "piktd not running!"
fi
if #pid("piktd") == #err()
output mail "multiple piktd running!"
fi
begin
if #procid("piktd") == #nil()
// since there is no piktd, something else, e.g.,
// crond, must have run this script; so we will only
// get mail and logging of piktd being down on
// systems, e.g., the piktmaster, where this is
// cron'ed
output mail "PIKT (piktd) on =pikthostname is dead or unwell"
output log "=piktheartbeat_log"
"PIKT (piktd) on =pikthostname is dead or unwell"
waitexec(P, C, T, W) // wait for termination of one process before
// doing a subsequent exec or exec wait
// (P) is the process (e.g., "=piktc")
// (C) is the subsequent comment (e.g.,
// "=piktc -iv ALL -H down"
// (T) is the number of seconds to pause between
// (P) checks (e.g., 60)
// (W) is whether do 'exec wait', else just do 'exec'
// (e.g., #true())
// sample use: =waitexec("piktc",
// "piktc -iv ALL -H down", 60, #false())
while #pid((P)) != #nil()
pause (T)
endwhile
if (W)
=execwait (C)
else
=exec (C)
endif
SEE ALSO
#ppid(), #pprocid(), #pprocessid()
Numerical Functions
String Functions