in reply to Timed event within a script
To answer your question as stated, I would look first at an event loop, which in my preference would be AnyEvent. You might particularly consider the section in the tutorial headed Timers and other event sources to implement your 30-minute schedule.
The second function is for the script to send an "I'm alive" email every 30 mins or so
That, however is the intriguing part. I cannot think why you would want this - it sounds much more likely that you'd want to be alerted every 30 minutes or so if it wasn't alive - ie. in normal operation it's quiet, but when it is not running you receive an "I'm dead" email.
Either way the trivial solution is not a Perl one but an O/S one: a cron job to run every 30 minutes which checks the process is running and sends your email if it is (or is not, as preferred).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Timed event within a script
by bajangerry (Sexton) on Mar 08, 2017 at 13:22 UTC | |
by Marshall (Canon) on Mar 09, 2017 at 01:13 UTC | |
by bajangerry (Sexton) on Mar 09, 2017 at 20:18 UTC | |
by Marshall (Canon) on Mar 10, 2017 at 21:29 UTC |