SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Cron jobs

Hybrid View

  1. #1
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,811
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Cron jobs

    I always get our hosting team (managed server) to set these up, but hate not being able to do things!

    I currently run a little bit of php on www.meetinthemiddle.co.uk that changes the "featured venue" each time the index.php page is loaded. It just picks a random record from the db. I'd like to actually make this change daily - and obviously a cron job is in order - but I haven't the foggiest how to do it myself.

    I could get the team to do it, but would really like to expand my skills base and learn how to do it.

    At the mo, I'm guessing that I could make the server load a php page that changes the record daily - am I thinking along the right lines? And if so, can anyone offer a little guidance?

    Cheers,

    H
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS

  2. #2
    I'm NOT an Addict ! TheRock's Avatar
    Join Date
    Jul 2001
    Location
    Earth ... maybe
    Posts
    401
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How about this:

    Instead of generating a random number (whose random seed is initialized based on time of day in seconds...), you initialize the random seed generator with the current date. Then generate random number (or even just hash the current date in some manner to get a number).

    This would eliminate the need for any cron jobs/daily scripts,etc.etc.
    -*-
    B-School Forums - GMAT / MBA / Admissions discussions
    -*-

  3. #3
    epsilon transition cupid's Avatar
    Join Date
    Aug 2001
    Location
    Kent, Ohio
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Cron jobs

    Originally posted by TheOriginalH
    At the mo, I'm guessing that I could make the server load a php page that changes the record daily - am I thinking along the right lines? And if so, can anyone offer a little guidance?
    Yes, you sure could have a cronjob run a php script. But remember, you'll want to compile the php into a cgi first before you can run it as a binary.

    Here's a tutorial on creating cgi's with php:
    http://www.tldp.org/HOWTO/PHP-HOWTO-18.html

    And here's a tutorial on setting up cronjobs:
    http://www.superscripts.com/tutorial/crontab.html

  4. #4
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,811
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I believe that is the holy grail I've been looking for, thanks very much

    I'm a little confused about the whole php/cgi thing, but then I always have been and need to understand it better...
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS

  5. #5
    SitePoint Member
    Join Date
    Jun 2002
    Location
    Italy
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  6. #6
    Hi there! Owen's Avatar
    Join Date
    Jan 2000
    Location
    CA
    Posts
    1,165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or use fetch or lynx and access the page actomatically online using a password protected page. It's easy and works well

    Owen


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
  •