Exec Process Macros

The macros in the sample exec_process_macros.cfg configuration file below are for executing processes in a special way--to suppress execution (when testing, for example), to wait on another process, or for other special purposes.

///////////////////////////////////////////////////////////////////////////////
 
// exec process macros - process execution
 
///////////////////////////////////////////////////////////////////////////////

donothing       // nullop
                =piktnullchar
 
///////////////////////////////////////////////////////////////////////////////

status
#ifndef holiday
                status __PIKTSTATUS__
#elsedef
                status suspended
#endifdef
 
///////////////////////////////////////////////////////////////////////////////
// the doexec define lets us control whether actions are exec'ed else
// a report of intent is emailed only; in earlier versions of PIKT,
// this conditionality was handled this way in alarms.cfg:
// 
// #ifdef doexec
//                      exec wait "=chgrp $grp $dir"
// #elsedef
//                      output mail "=chgrp $grp $dir"
// #endifdef
// 
// with the macros below, we can now achieve the same effect by
// replacing the above five lines with just this one line:
// 
//                      =execwait "=chgrp $grp $dir"
// 
   
#ifdef doexec
exec            exec
execwait        exec wait
 
doexec          doexec
doexecwait      doexec wait
#elsedef
exec            output mail
execwait        output mail
 
doexec          output mail
doexecwait      output mail
#endifdef
 
///////////////////////////////////////////////////////////////////////////////

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
 
///////////////////////////////////////////////////////////////////////////////

Open Hand For more examples, see Samples.

 
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 2008-03-27.   This site is PIKT® powered.
PIKT® is a registered trademark of the University of Chicago.   Copyright © 1998-2008 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
process
macros