Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Scheduling a query

  • 26-01-2008 02:58AM
    #1
    Registered Users, Registered Users 2 Posts: 9,228 ✭✭✭


    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, Registered Users 2 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, Registered Users 2 Posts: 9,228 ✭✭✭Chardee MacDennis


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


Advertisement