Process Macros

[posted 2001/04/19]

Here are some other recently developed process macros that you might find useful or interesting:

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

outputproc(C, P)        // send all output from process (P) to communications
                        // channel (C)
                        // (C) is the comm channel (e.g., mail, syslog, print)
                        // (P) is the process (e.g., "=ll /tmp")
                        // sample use:  =outputproc(mail, "=ll /tmp")
                        do #popen(OUTPUTPROC, (P), "r")
                        while #read(OUTPUTPROC) > 0
                                output (C) $rdlin
                        endwhile
                        do #pclose(OUTPUTPROC)  

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

outputfile(C, F)        // send all output from file (F) to communications
                        // channel (C)
                        // (C) is the comm channel (e.g., mail, syslog, print)
                        // (F) is the file (e.g., "=crontabs/$name")
                        // sample use:  =outputfile(mail, "=crontabs/$name")
                        do #fopen(OUTPUTFILE, (F), "r")
                        while #read(OUTPUTFILE) > 0
                                output (C) $rdlin
                        endwhile
                        do #fclose(OUTPUTFILE)  

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

outputlogfile(C, L)     // send new entries in logfile (L) to communications
                        // channel (C)
                        // (C) is the comm channel (e.g., mail, syslog, print)
                        // (L) is the logfile (e.g., "=sulog")
                        // sample use:  =outputlogfile(syslog, "=sulog")
                        // note:  this takes the place of 'input logfile "..."'
                        input logfile (L)
                        rule
                                output (C) $inlin

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

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)
                                exec wait (C)
                        else
                                exec (C)
                        endif

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

The last process macro is useful, for example, if you have different alarm scripts calling piktc, and you don't want one running piktc blocking another.

For more examples, see Developer's Notes.

 
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
dead system
processes
Pikt script