Reply
Old 07-26-2009, 10:36 AM Cron Jobs
Skilled Talker

Posts: 73
Name: Jose daSilva
Trades: 0
Hi

I need to have on my website a jobcron to do the following jobs:
  • To warn the registered user by mail that is job ends in 15 days, 7 days and 3 days, and that he must activate again.
  • To warn the registered user by mail that is job expired.
  • To send a newsletter every month, choosing randomly certain jobs.

Can somebody help?

Thanks
josil is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 07-27-2009, 02:24 AM Re: Cron Jobs
Experienced Talker

Posts: 31
Name: Barry Adams
Location: London
Trades: 0
The best thing to do would be a one cron job that would hourly, and compares the dates of each job against the mailing times.

The cron entry is (run once a hour on the hour)

0 * * * * sendjobwarnings

Then something like, psuedocode, change to match your favourite
scripting language, and database protocols.

now = timenow();
foreach job in database {
expiretime = dblookup("select expiretime from table where jobid="+job+";");
user = dblookup("select username from table where jobid="+job+";");
if ( (expiretime-now)<0 and (expiretime-now)>-onehour){ emailuser_jobexpiredmessage; }
if (expiretime-now)<7days && (expire-now)>7days-onehour){
emailuser_jobtoexpirein7daysmessage; }
}
... 14 days 3 days etc
}

Hope this help

PHP Programming Feed @ Feed Distiller
badams is offline
Reply With Quote
View Public Profile Visit badams's homepage!
 
Reply     « Reply to Cron Jobs
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.13696 seconds with 13 queries