#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
 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
passwd/shadow
crosscheck
Pikt script