egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bind time triggered every month?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Fill
Halfop


Joined: 18 Jan 2009
Posts: 80

PostPosted: Fri Sep 04, 2009 4:57 am    Post subject: Bind time triggered every month? Reply with quote

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 Question

Thanks in advance
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Fri Sep 04, 2009 6:00 am    Post subject: Reply with quote

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
View user's profile Send private message
Fill
Halfop


Joined: 18 Jan 2009
Posts: 80

PostPosted: Fri Sep 04, 2009 10:49 am    Post subject: Reply with quote

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 Razz

Once again, thanks for the fast and great reply.

See you arround,
Fill
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Fri Sep 04, 2009 4:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Fri Sep 04, 2009 5:07 pm    Post subject: Reply with quote

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 Razz

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
View user's profile Send private message
Fill
Halfop


Joined: 18 Jan 2009
Posts: 80

PostPosted: Sat Sep 05, 2009 3:25 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber