| View previous topic :: View next topic |
| Author |
Message |
Fill Halfop
Joined: 18 Jan 2009 Posts: 80
|
Posted: Fri Sep 04, 2009 4:57 am Post subject: Bind time triggered every month? |
|
|
Hi guys,
I was wondering how can I make a bind time that calls the script every month. E.g. if I wanted to execute it every minute, it would be:
| Code: |
bind time - "00 * * * *" proc
|
But I want it every month, not every minute.. any ideas
Thanks in advance |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Fri Sep 04, 2009 6:00 am Post subject: |
|
|
I am also interested in a competent reply to this question. Time masks seem to be something of an artform.
First off, in an earlier thread just a few days ago we have established that a very simple mask would yield every minute. As follows :-
| Code: |
bind TIME - * procname
|
The way I would tackle the problem of once per month is to specify the minute/hour/day that I would like the bind to trigger, such as :-
| Code: |
bind TIME - "20 10 15 * *" procname
|
I would take that to read .. at 10:20am on the 15th of every month of every year. Don't forget to choose a day that exists in all months. _________________ I must have had nothing to do |
|
| Back to top |
|
 |
Fill Halfop
Joined: 18 Jan 2009 Posts: 80
|
Posted: Fri Sep 04, 2009 10:49 am Post subject: |
|
|
Hi arfer,
Thanks for your reply - that was a good idea. I chose to make it like this:
| Code: |
bind time - "00 00 28 * *" clear_records
|
That way it will run almost in the end of the month, except for february, which will run exactly in the end of the month. So my issue should be solved by now.
Aditionally, I'd like to know if there is really anyway to make our eggies know when a month finished, even if it's a month with 30 or 31, or if it's February. Just for curiosity ... my script doesn't need to run exactly in the end of every month, but now I'm curious about it
Once again, thanks for the fast and great reply.
See you arround,
Fill |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Fri Sep 04, 2009 4:42 pm Post subject: |
|
|
It would be possible to write a Tcl script that runs recursively to test how close to the end of a particular month it is, using [unixtime] or [clock seconds] to get the local time and some form of [clock format] to derive the day and time of the month. Then trigger some action if it is within a preset timeframe prior to month end. Frankly, I think it would be a major waste of time and resource. _________________ I must have had nothing to do |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Fri Sep 04, 2009 5:07 pm Post subject: |
|
|
| Fill wrote: | Hi arfer,
Thanks for your reply - that was a good idea. I chose to make it like this:
| Code: |
bind time - "00 00 28 * *" clear_records
|
That way it will run almost in the end of the month, except for february, which will run exactly in the end of the month. So my issue should be solved by now.
Aditionally, I'd like to know if there is really anyway to make our eggies know when a month finished, even if it's a month with 30 or 31, or if it's February. Just for curiosity ... my script doesn't need to run exactly in the end of every month, but now I'm curious about it
Once again, thanks for the fast and great reply.
See you arround,
Fill |
Why do you test for the end of the month before it has occured? | Code: | | bind time "00 00 01 * *" clear_records |
You only really need to know at exactly which point when the old month has expired. The easiest way to do this is simply check against first day of every new month at exactly midnight. You bind to this event instead and it's easier and more accurate. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
Fill Halfop
Joined: 18 Jan 2009 Posts: 80
|
Posted: Sat Sep 05, 2009 3:25 am Post subject: |
|
|
ahhhh, right, didn't even think about that!! lol.... thanks a lot for the reply. that will do it...
@ arfer:
Yeap, I agree that such script would give me a lot of unnecessary work.
Once again, thanks for your help.
See you |
|
| Back to top |
|
 |
|