SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Schedule PHP event using Cron in WinXP

    Can someone help me understand this Cron business? I started doing some research but got kinda lost. It's also the first time for me doing some of these things. I currently am using an external device for scheduling and triggering PHP scripts, and it's working ok, but it's becoming clear that that is just an extra un-needed step as I can do it all "in-the-box". I'm using WinXP running PHP version 5.x and a recent version of Apache...

    I simply need to be able to setup a day's worth of events that trigger a PHP script located on the same machine. I'll need to pass it perameters to call spacific functions and check on other things - which I'm already doing now, but I imagine it's gonna have to be handled differently using Cron...

    First of all, my biggest question, what version should I use? I found several of them, some free, some not... will pycron be cool? Or simply Cron (on that same website)? I don't need any GUI like in "VisualCron", a text file is enough.

    So, help me understand, Cron is always checking this text file that contains info for when and what to execute. If I want to be able to make modifications, or to load an entire day's worth of events, I can simply edit the text files using fopen, fread, fwrite commands? I've not used these yet but feel confident in getting this part to work, but is this the most elegent way to go about it?

    Because the PHP files I want to trigger are local (on the same machine I'll be having Cron running), will I need something like Wget? When I setup the commands in the CRONTAB file, I can simply use "php.exe" followed by the filename and any arguments I want?

    Any examples would be great, or if I'm totally off on something or not clear please chime in. My last question, which is not super important, Is there a "Cron" that can trigger things at specified second, like at 12:35:30 PM?

  2. #2
    Keep it simple, stupid! bokehman's Avatar
    Join Date
    Jul 2005
    Posts
    1,935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cron jobs are a Unix feature not windows.

  3. #3
    SitePoint Zealot musher's Avatar
    Join Date
    Nov 2005
    Location
    Hull, England
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unix cron daemon's only go down to minutes I believe, so you can't run jobs half way through a minute. Unless you put a
    PHP Code:
    sleep(30
    in your script. I assume it's the same for the windows versions.

  4. #4
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't understand, I'm using Cron in Windows right now, seems fine...

    OK so maybe I answered my own question in regards to what version to get. The other questions still apply...

    Thanks

  5. #5
    SitePoint Wizard triexa's Avatar
    Join Date
    Dec 2002
    Location
    Canada
    Posts
    2,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you're on windows... why are you trying to download some cron program as oppose to using the built-in task scheduler?
    AskItOnline.com - Need answers? Ask it online.
    Create powerful online surveys with ease in minutes!
    Sign up for your FREE account today!
    Follow us on Twitter

  6. #6
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd just like to explore other options, and this seems easier to use and more flexible. I've definately looked at working with the bulit-in windows scheduler but I'm not entirely hapy with it so far.

  7. #7
    SitePoint Wizard triexa's Avatar
    Join Date
    Dec 2002
    Location
    Canada
    Posts
    2,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm well to each their own I suppose

    I just say that the windows task scheduler will handle anything and everything you need
    AskItOnline.com - Need answers? Ask it online.
    Create powerful online surveys with ease in minutes!
    Sign up for your FREE account today!
    Follow us on Twitter

  8. #8
    Keep it simple, stupid! bokehman's Avatar
    Join Date
    Jul 2005
    Posts
    1,935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sdesigns
    the windows task scheduler
    Where is that?

  9. #9
    SitePoint Wizard triexa's Avatar
    Join Date
    Dec 2002
    Location
    Canada
    Posts
    2,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    start -> Control panel -> Scheduled tasks
    AskItOnline.com - Need answers? Ask it online.
    Create powerful online surveys with ease in minutes!
    Sign up for your FREE account today!
    Follow us on Twitter


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
  •