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 

Running a proc using bind time

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


Joined: 04 Jan 2013
Posts: 49

PostPosted: Tue Jul 08, 2014 1:26 pm    Post subject: Running a proc using bind time Reply with quote

Im trying to run a proc using bind time im trying to get it to run at midnight on sunday but the code doesnt work.

Here's what i have so far

Code:
bind time - "00 00 24 7 *" procname


am i anywhere near getting it right plz
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Tue Jul 08, 2014 2:35 pm    Post subject: Re: Running a proc using bind time Reply with quote

See:
http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html
and find:
bind time

It says:
Quote:

mask matches 5 space separated integers of the form: "minute hour day month year". minute, hour, day, month have a zero padding so they are exactly two characters long; year is four characters.


Could that be the problem?

While you are there, you might like to find
bind cron
and read about it too.
I'm not sure what you are really trying to do, but it is possible that
bind cron
might suit your needs better.

I hope this helps.
Back to top
View user's profile Send private message
COBRa
Halfop


Joined: 04 Jan 2013
Posts: 49

PostPosted: Thu Jul 24, 2014 11:55 am    Post subject: Reply with quote

Thx for the reply been on this for a while now with no success ive read the links but no joy ive even setup a test but it doesnt work

Code:
bind time - "00 00 24 7 *" week:ended


proc week:ended { minute hour day month year } {


  putlog "END OF WEEK"

}


ive tried several different ways any help would be greatfully apprecaited
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Thu Jul 24, 2014 12:17 pm    Post subject: Reply with quote

To me, when I read this:
Quote:

minute, hour, day, month have a zero padding so they are exactly two characters long;


it means this:
Code:

bind time - "00 00 24 07 *" week:ended


Perhaps I'm understanding the doc incorrectly. How do you interpret it?
Back to top
View user's profile Send private message
COBRa
Halfop


Joined: 04 Jan 2013
Posts: 49

PostPosted: Thu Jul 24, 2014 12:27 pm    Post subject: Reply with quote

now i look at it tht makes sense will try it and report back many thanks
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Thu Jul 24, 2014 1:15 pm    Post subject: Reply with quote

I tried it too, it didn't work for me either. Smile

With a few minutes experimenting, I found it.

This works:
bind time -|- "* 17 24 06 2014" a_test_proc

running that proc once every minute. That's as far as I tested it.

The trick: see that 06 in there?
I found that by intuitively trying it.
Afterwards, I found:
http://forum.egghelp.org/viewtopic.php?p=72492#72492

I hope this helps.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Jul 24, 2014 1:48 pm    Post subject: Reply with quote

G'evening Gents,
You will not be able to create a mask that will trigger on "sundays", mainly because there's no weekday-field in the mask. The "day" part refers to the day of month.

If you'd like the binding to trigger on a specific date, then that is obviously possible, however...
As mentioned throughout the thread, single-digit values must be prefixed by 0, month starts at 0, day of month starts at 1.

To trigger on every sunday however, you'll need to use the cron binding instead:
Code:
bind cron - "0 0 * * 0" a_test_proc
#Triggers at 0:00 every sunday

_________________
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: Thu Jul 24, 2014 2:15 pm    Post subject: Reply with quote

nml375 wrote:

...

To trigger on every sunday however, you'll need to use the cron binding instead:


That's why I said:
Quote:

While you are there, you might like to find
bind cron
and read about it too.
I'm not sure what you are really trying to do, but it is possible that
bind cron
might suit your needs better.


in my first response to him. Since he didn't comment on it, or even acknowledge it, I dropped back to simply trying to answer what he specifically asked.
I'm glad you took the time to bring it up, again.
Back to top
View user's profile Send private message
COBRa
Halfop


Joined: 04 Jan 2013
Posts: 49

PostPosted: Fri Jul 25, 2014 12:57 pm    Post subject: Reply with quote

Thanks guys will test the bind cron and report back.

ok i get this error


Code:
bad type, should be one of: act, away, bcst, bot, chat, chjn, chof, chon, chpt, ctcp, ctcr, dcc, disc, evnt, filt, flud, join, kick, link, load, mode, msg, msgm, need, nick, nkch, notc, note, part, pub, pubm, raw, rejn, sign, splt, time, topc, unld, wall


i presume its because i use 1.6.19

Is there no other way round it or should i upgrade ?


Last edited by COBRa on Fri Jul 25, 2014 1:17 pm; edited 1 time in total
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Jul 25, 2014 1:17 pm    Post subject: Reply with quote

Which version of eggdrop are you using?

Might add, that the cron binding is only available in 1.6.20 onwards..
If you've got an older eggdrop, you could use something along these lines as a workaround:
Code:
bind time - "00 00 *" someproc
proc someproc {min hour day month year} {
  if {[clock format [clock seconds] -format "%u"] == 7} {
    #Today is sunday, so do something here...
  }
}

_________________
NML_375, idling at #eggdrop@IrcNET


Last edited by nml375 on Fri Jul 25, 2014 1:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Fri Jul 25, 2014 1:25 pm    Post subject: Reply with quote

COBRa wrote:

...
i presume its because i use 1.6.19

Is there no other way round it or should i upgrade ?



See:
http://eggwiki.org/1.6.20#Bind_types_added

I use 1.6.21 , and recommend that you upgrade to it.

I don't know if there is any other way around it. That's a question for nml375, but I expect that he will recommend that you upgrade, too.
Back to top
View user's profile Send private message
COBRa
Halfop


Joined: 04 Jan 2013
Posts: 49

PostPosted: Fri Jul 25, 2014 1:36 pm    Post subject: Reply with quote

ok will do
Back to top
View user's profile Send private message
COBRa
Halfop


Joined: 04 Jan 2013
Posts: 49

PostPosted: Tue Jul 29, 2014 10:04 am    Post subject: Reply with quote

nml375 wrote:
G'evening Gents,
You will not be able to create a mask that will trigger on "sundays", mainly because there's no weekday-field in the mask. The "day" part refers to the day of month.

If you'd like the binding to trigger on a specific date, then that is obviously possible, however...
As mentioned throughout the thread, single-digit values must be prefixed by 0, month starts at 0, day of month starts at 1.

To trigger on every sunday however, you'll need to use the cron binding instead:
Code:
bind cron - "0 0 * * 0" a_test_proc
#Triggers at 0:00 every sunday


hi guys did some testing and the bind cron actioned the proc but on saturday and not sunday at midnight am i missing something ??

so would this work instead ?

Code:
bind cron - "0 0 * * 7" a_test_proc
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Jul 29, 2014 12:40 pm    Post subject: Reply with quote

Actually, this does trigger on Sundays at 0:00 hour. To be more specific, it would be at midnight when Saturday turns to Sunday.

To have it trigger on the start of the new week, you'd need to match against Monday:
Code:
bind cron - "0 0 * * 1" a_test_proc

_________________
NML_375, idling at #eggdrop@IrcNET
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