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 ///////////////////////////////////////////////////////////////////////////////
For more examples, see Samples.