This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Running a proc using bind time

Help for those learning Tcl or writing their own scripts.
Post Reply
C
COBRa
Halfop
Posts: 49
Joined: Fri Jan 04, 2013 8:23 am

Running a proc using bind time

Post by COBRa »

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: Select all

bind time - "00 00 24 7 *" procname
am i anywhere near getting it right plz
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

Re: Running a proc using bind time

Post by willyw »

See:
http://www.eggheads.org/support/egghtml ... mands.html
and find:
bind time

It says:
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.
C
COBRa
Halfop
Posts: 49
Joined: Fri Jan 04, 2013 8:23 am

Post by COBRa »

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: Select all

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
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

To me, when I read this:
minute, hour, day, month have a zero padding so they are exactly two characters long;
it means this:

Code: Select all

bind time - "00 00 24 07 *" week:ended
Perhaps I'm understanding the doc incorrectly. How do you interpret it?
C
COBRa
Halfop
Posts: 49
Joined: Fri Jan 04, 2013 8:23 am

Post by COBRa »

now i look at it tht makes sense will try it and report back many thanks
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

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

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.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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: Select all

bind cron - "0 0 * * 0" a_test_proc
#Triggers at 0:00 every sunday
NML_375
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

nml375 wrote: ...

To trigger on every sunday however, you'll need to use the cron binding instead:
That's why I said:
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.
C
COBRa
Halfop
Posts: 49
Joined: Fri Jan 04, 2013 8:23 am

Post by COBRa »

Thanks guys will test the bind cron and report back.

ok i get this error

Code: Select all

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.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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: Select all

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...
  }
}
Last edited by nml375 on Fri Jul 25, 2014 1:26 pm, edited 1 time in total.
NML_375
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

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.
C
COBRa
Halfop
Posts: 49
Joined: Fri Jan 04, 2013 8:23 am

Post by COBRa »

ok will do
C
COBRa
Halfop
Posts: 49
Joined: Fri Jan 04, 2013 8:23 am

Post by COBRa »

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: Select all

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: Select all

bind cron - "0 0 * * 7" a_test_proc 
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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: Select all

bind cron - "0 0 * * 1" a_test_proc
NML_375
Post Reply