21286 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 245 Views |
-
ScheduledTask not working ... noob help please!

9 November 2011 at 7:55pm
Hi All,
I've been racking the forums for 2 hours now and only seem to be moving forward slowly...
I've extended QuarterHourlyTask as follows:
<?php
class ZQQuarterHourlyTask extends QuarterHourlyTask {
public function process(){
$From = "test@gmail.com";
$To = "test@gmail.com";
$email = new Email($From, $To, "TEST TASK", "TEST TASK");
$email->send();
Debug::message("Yes it works! Yippie!");
}
}this seems to work fine if I go to http://mysite/ZQQuarterHourlyTask and the email gets sent a-ok and I can see the debug message.
Problem is... as of yet it doesn't send the email automatically every fifteen minutes it ONLY works when I test it through the URL?
Am I missing somthing here?
Any help would be great! I'm tearing my hair out.
I'm running wamp on a pc if that helpsThanks heaps!
Jamie
-
Re: ScheduledTask not working ... noob help please!

10 November 2011 at 11:42am
Anyone? please help.
was up till 4am trying to solve this one and had nightmares about code... lol
Cheers
Jamie -
Re: ScheduledTask not working ... noob help please!

10 November 2011 at 12:56pm
Hi Jamie,
I wasn't aware of this function before but if you look at the API docs http://api.silverstripe.org/trunk/sapphire/cron/ScheduledTask.html you can see that it's not enough to subclass a ScheduledTask - you still have to trigger the tasks by using something like cron. There's a sample cron setup on that page but I'm not sure how you would set up same on WAMP.
-
Re: ScheduledTask not working ... noob help please!

11 November 2011 at 11:29pm
Thanks Jono!
So I'm kinda safe to say that if testing through the browser works fine then I dont need to worry untill the site is on the live server? then I'll hassle the hosting guys to help me out? lol
If it works in the url test then it should be fine once the server guys create a cron job etc etc...
Can I de-stress a bit now?
Cheers
Jamie -
Re: ScheduledTask not working ... noob help please!

12 November 2011 at 12:54pm
I think so
cron jobs aren't hard to set up in something like cpanel so if it works through the URL then I think you should be good
| 245 Views | ||
|
Page:
1
|
Go to Top |


