PIKT

Samples: Exec Process Macros

PIKT Logo
Home FAQ News Intro Samples Tutorial Reference Software Authors Licensing SiteSearch


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

///////////////////////////////////////////////////////////////////////////////

// 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
#elsedef
exec            output mail
execwait        output mail
#endifdef

// see the sample alarms.cfg for many more examples of this trick

///////////////////////////////////////////////////////////////////////////////

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 downsys"
                        // (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 downsys",
                                                  60, #false())
                        while #pid((P)) != #nil()
                                pause (T)
                        endwhile
                        if (W)
                                =execwait (C)
                        else
                                =exec (C)
                        endif

///////////////////////////////////////////////////////////////////////////////

[For more examples, see Samples.]

Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software | Authors | Licensing | SiteSearch
Links | SiteIndex | Pikt-Users | Pikt-Workers | Contribute | ContactUs | Top of Page
Page best viewed at 1024x768.   Page last updated 2005-06-22.
This site is PIKT® powered.
PIKT® is a registered trademark of the University of Chicago.
Copyright © 1998-2005 Robert Osterlund.  All rights reserved.

Computer Books at Amazon.com

Beginning SuSE Linux: From Novice To Professional
Beginning SuSE Linux: From Novice To Professional

Red Hat Linux 9 for Dummies
Red Hat Linux 9 for Dummies

Sams Teach Yourself SuSE Linux in 24 Hours Starter Kit
Sams Teach Yourself SuSE Linux in 24 Hours Starter Kit

Linux Cookbook
Linux Cookbook

Red Hat Enterprise Linux 4 For Dummies
Red Hat Enterprise Linux 4 For Dummies