The less you have to put into a crontab, the better. There's no reason to pass code fragments into a script via command line, much less an automated one.
You're on the right track, however, by generalizing the problem and anticipating future uses for your notification script.
The larger problem you're confronting is three things:
- detect
- select
- deliver
Once you have removed the liver from your selected recipients, your task is complete.
Seriously, though. Break the tasks down and, if not put them into their own modules, at least put them into their own subroutines.
For example, rather than passing code fragments into your script via command line, use a hash for dispatching to the correct test routine; that way you can pass a parameter called "day_stale" and not worry about the quarantine and sanitization of arbitrary code.
Finally, why not consider the unix way of things? If find -ctime 1 myfilename comes up empty, your file has been dead for a day.
Cheers,
Matt
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.