Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Scheduling a query

Options
  • 26-01-2008 3:58am
    #1
    Registered Users Posts: 9,225 ✭✭✭


    I need to send out an email on a regular basis that is generated from a mysql database, is there any easy way to schedule a bit of php code to run daily?

    thanks!


Comments

  • Registered Users Posts: 981 ✭✭✭fasty


    You can schedule stuff on a *Nix system with Cron

    Windows has it's own scheduler of some sort and Mac OS X has launchd


  • Closed Accounts Posts: 1,444 ✭✭✭Cantab.


    I want to run a cron job every minute! My server only allows once every 15 minutes... I wonder can I run 15 separate crons spaced 15 minutes apart???

    For the OP -- type in 'crontab -p' and a summary will come up on how to use crontab. 'crontab -e' allows you to add and edit jobs.

    Add this line to your cron job file:
    * * * * * http://www.yoursite.com/generate_email.php
    

    The above runs every minute of every hour of every day, every week, etc. Replace the *'s with numbers to get the desired time-frame.

    I'd make sure that generate_email.php is in a restricted directory otherwise anyone could send an email when they wanted!


  • Registered Users Posts: 9,225 ✭✭✭Chardee MacDennis


    nice one, really appreciated. never really paid much attention to cron jobs before, looks like thats gonna change!


Advertisement