Output Scheduling Macros

The macros in the sample output_scheduling_macros.cfg configuration file below are for scheduling the frequency of script output--for example, to send output just once daily, or hourly, or every two hours, or any arbitrary time interval, etc.

///////////////////////////////////////////////////////////////////////////////
 
// output scheduling macros
 
///////////////////////////////////////////////////////////////////////////////
 
driftfactor             300
 
///////////////////////////////////////////////////////////////////////////////

once_daily(A)           // perform action(s) (A) just once daily
                        // set #hr = #hour() before invoking this
                        if #hr < %hr
                                (A)
                        fi
 
///////////////////////////////////////////////////////////////////////////////

periodically(A1, A2, M) // perform action(s) (A1) every (M) minutes,
                        // otherwise default to action(s) (A2)
                        set #tv = #now()
                        if ! #defined(%tv) || (#tv - %tv >= (M)*60 - =driftfactor)
                                (A1)
                        else
                                (A2)
                                set #tv = %tv
                        fi
 
///////////////////////////////////////////////////////////////////////////////

hourly(A1, A2)          // perform action(s) (A1) just once hourly,
                        // otherwise default to action(s) (A2)
                        set #tv60 = #now()
                        if ! #defined(%tv60) || (#tv60 - %tv60 >= 60*60 - =driftfactor)
                                (A1)
                        else
                                (A2)
                                set #tv60 = %tv60
                        fi
 
///////////////////////////////////////////////////////////////////////////////

every_two_hours(A1, A2) // perform action(s) (A1) every two hours,
                        // otherwise default to action(s) (A2)
                        set #tv120 = #now()
                        if ! #defined(%tv120) || (#tv120 - %tv120 >= 120*60 - =driftfactor)
                                (A1)
                        else
                                (A2)
                                set #tv120 = %tv120
                        fi
 
///////////////////////////////////////////////////////////////////////////////

every_four_hours(A1, A2) // perform action(s) (A1) every four hours,
                        // otherwise default to action(s) (A2)
                        set #tv240 = #now()
                        if ! #defined(%tv240) || (#tv240 - %tv240 >= 240*60 - =driftfactor)
                                (A1)
                        else
                                (A2)
                                set #tv240 = %tv240
                        fi
 
///////////////////////////////////////////////////////////////////////////////

every_six_hours(A1, A2) // perform action(s) (A1) every six hours,
                        // otherwise default to action(s) (A2)
                        set #tv360 = #now()
                        if ! #defined(%tv360) || (#tv360 - %tv360 >= 360*60 - =driftfactor)
                                (A1)
                        else
                                (A2)
                                set #tv360 = %tv360
                        fi
 
///////////////////////////////////////////////////////////////////////////////

daily(A1, A2)           // perform action(s) (A1) just once daily,
                        // otherwise default to action(s) (A2)
                        set #tvdaily = #now()
                        if ! #defined(%tvdaily) || (#tvdaily - %tvdaily >= 1440*60 - =driftfactor)
                                (A1)
                        else
                                (A2)
                                set #tvdaily = %tvdaily
                        fi
 
///////////////////////////////////////////////////////////////////////////////

weekly(A1, A2)          // perform action(s) (A1) just once weekly,
                        // otherwise default to action(s) (A2)
                        set #tvweekly = #now()
                        if ! #defined(%tvweekly) || (#tvweekly - %tvweekly >= 7*1440*60 - =driftfactor)
                                (A1)
                        else
                                (A2)
                                set #tvweekly = %tvweekly
                        fi
 
///////////////////////////////////////////////////////////////////////////////

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 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
Learn new
techniques for
alert e-mail routing