#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    21
    Rep Power
    0

    PHP to run a Scheduled Event


    I woudl like to use PHP to run a scheduled event every Sunday at midnight -- copy a file to a new location.

    Can I?
  2. #2
  3. Wiking
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Sep 2000
    Location
    Sweden
    Posts
    3,608
    Rep Power
    27
    No. But you could use cron or at to do it for you. Create a PHP-page that copies the file as you want. And then create a script that either calls lynx with the URL to that PHP-page (dont forget the -dump option) or call the PHP-page directly (if PHP was compiled as a CGI).

    /NoXcuz
    UN*X is sexy!
    who | grep -i blonde | date; cd ~; unzip; touch; strip; finger; mount; gasp; yes; uptime; umount; sleep
  4. #3
  5. No Profile Picture
    Dev
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2001
    Posts
    1,436
    Rep Power
    41
    Yeah you can do that... Noxcuz i don't know why you said no then explained how he could do it. Interesting

    If you have PHP compiled as a stand-alone binary (i.e. not an apache module), you can run it as a cron job, without having to call lynx or wget or any of that.

    You could have a cron job that looked like this:

    0 0 * * * 0 /usr/bin/php /path/to/your-script.php

    I think that would run at midnight on sunday but I could be wrong.. i'm not very good at cron jobs.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    21
    Rep Power
    0
    I keep hearing about cron jobs, but I find nothing much about it.

    Anyone know of a good cron tutorial?
  8. #5
  9. Wiking
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Sep 2000
    Location
    Sweden
    Posts
    3,608
    Rep Power
    27
    I said no because you can't use PHP alone to perform a scheduled task.
    You would have to use some scheduler as CRON or AT to call the PHP-page etc...

    Some information:
    http://www.faqts.com/knowledge_base/...d/1005/fid/436

    /NoXcuz
    UN*X is sexy!
    who | grep -i blonde | date; cd ~; unzip; touch; strip; finger; mount; gasp; yes; uptime; umount; sleep

IMN logo majestic logo threadwatch logo seochat tools logo