[Remind-Fans] Using remind to run script daily if not weekend or holiday
Gustav H Meyer
ghmeyer at gmail.com
Fri May 9 16:43:00 EDT 2008
Hi David,
Wow that was a quick response. Thanks.
David F. Skoll wrote:
> Gustav H Meyer wrote:
>> How can I use remind to act as a filter whereby it will check whether a
>> day falls on a holiday or weekend and thus only run on a real working day?
>
> # --- cut here and save as checkholiday.rem:
> # Don't run on weekends
> IFTRIG Sat Sun
> EXIT 1
> ENDIF
>
> # Pull in list of holidays
> INCLUDE list_of_holidays.rem
>
> # Don't run on holidays
> IF isomitted(today())
> EXIT 1
> ENDIF
>
> # Otherwise it's OK to run
> EXIT 0
> # --- end of checkholiday.rem
>
> Then in your shell script:
>
> remind checkholiday.rem && run_time_consuming_task
It works, but I just want to make sure that I got it right. I've added
the 12th of May as a Holiday to test:
---- BEGIN list_of_holidays.rem
; Holiday or other days on which you do not want to run the script
OMIT 12 May 2008
---- END list_of_holidays.rem
Is that correct?
I guess so because it works.
$ remind checkholiday.rem 9 May 2008 && echo RUN SCRIPT
RUN SCRIPT
$ remind checkholiday.rem 10 May 2008 && echo RUN SCRIPT
$ remind checkholiday.rem 11 May 2008 && echo RUN SCRIPT
$ remind checkholiday.rem 12 May 2008 && echo RUN SCRIPT
$ remind checkholiday.rem 13 May 2008 && echo RUN SCRIPT
RUN SCRIPT
$ remind checkholiday.rem 1 Jun 2008 && echo RUN SCRIPT
$
Fantastic. Thanks a lot.
Regards,
Gustav
More information about the Remind-fans
mailing list