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 , with multiple values

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


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Fri Jan 01, 2010 3:00 pm    Post subject: bind time , with multiple values Reply with quote

Hello,

Does bind time accept values the same way as crontab does?


Here's what I'm doing:
I have a small script I drew up, and it uses :
bind time - "01 * * * *" do_announce
just fine. The procedure does an announcement in a channel, once per hour.

I'd like to experiment with making that once every other hour.
And other variations too.
Perhaps once every 3 or 4 hours.
Whatever... until I get it like I like it.

And I wondered if I could use entries like I found here:
http://ss64.com/bash/crontab.html
Would it be?:
bind time - "* 01,03,05,07,09,11,13,15,17,19,21,23 * * *" do_announce

If not, ...if bind time does not accept that, how would I go about it?


Thanks
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Jan 01, 2010 3:41 pm    Post subject: Reply with quote

The time binding simply does a glob-style matching of a fixed string being 'minute hour day-of-month month year' (of the curent time) against the mask provided in the binding. As such, you cannot use the more advanced syntax of crontab's.

You could, however, do additional checks on the hour within the triggered code. Ie: for every n:th hour, use the modulus function or so..
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Tue Jan 05, 2010 2:18 pm    Post subject: Reply with quote

nml375 wrote:
The time binding simply does a glob-style matching of a fixed string being 'minute hour day-of-month month year' (of the curent time) against the mask provided in the binding. As such, you cannot use the more advanced syntax of crontab's.


Thanks.

Another idea came to mind.
What would happen if I simply created more binds?
as in:
bind time - "0 01 * * *" do_announce
bind time - "0 03 * * *" do_announce
bind time - "0 05 * * *" do_announce
.
.
.
and so on.


Would that do it?
Would the do_annouce procedure run at 1:00am, 3:00am, 5:00am, and so on?


Quote:

You could, however, do additional checks on the hour within the triggered code. Ie: for every n:th hour, use the modulus function or so..


I don't get it, yet.
Can you elaborate a bit?


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


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

PostPosted: Tue Jan 05, 2010 3:55 pm    Post subject: Reply with quote

The following code executes at minute 00 for every 'ODD' hour by testing if the number of hours has a remainder after dividing by 2 (hour mod 2). The result can only be 1 (true) or 0 (false)

Code:

bind TIME - "00 * * * *" pTimeProc

proc pTimeProc {minute hour day month year} {
  if {$hour % 2} {
    # code here
  }
}

_________________
I must have had nothing to do
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