SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2005
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    looping a list of files to require and execute

    Hi, I'm doing this cron task portion of an admin site where by you can save new set tasks into DB, actual cron tasks is not set here btw, but when the actual cron task runs, it'll get this list from the DB and run all of them. All the tasks can be pretty complex requiring additional database connection and processing or time consuming.

    example:
    run=>'path/to/run_a.php';
    run=>'path/to/run_b.php';

    like
    PHP Code:
    while ( $tasks mysql_fetch_assoc($result) )
    {
        
    $vars 'set up some data, then ...';
        require (
    $tasks['run']);

    Is this wise? I have no experience with this kind of scheduled task. Thanks!

  2. #2
    SitePoint Addict
    Join Date
    May 2005
    Location
    London, ON
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Seems like a decent way of doing it to me. As long as each "job" that you're adding has been created efficiently this should work fine.
    Ryan Price
    Subscribe to my blog for regular tips and tricks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •