Quick Cron Job Question

Discussion in 'Programming' started by megler, Mar 31, 2008.

  1. #1
    I think this is an easy question, but the Big G has given me no results. :(

    If I want to create a cron job that refreshes my home page, say once an hour, how do I do that?

    I thought it would be as easy as creating a cron and identifying my index.php -- but that doesn't seem to do the trick because of page permissions(?). Because it's wordpress, i can't chance perms without irking WP. ugh.

    I know how to make a cron that does it's thing once per hour, I just don't know how to make a script that updates my index for the cron to go to. Does that make sense?

    Any help would be uber appreciated!

    Thanks!

    Marceia
     
    megler, Mar 31, 2008 IP
  2. NoobieDoobieDo

    NoobieDoobieDo Peon

    Messages:
    1,456
    Likes Received:
    53
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What do you mean by "refreshes" ? Is there a certain command you need run every hour ?
     
    NoobieDoobieDo, Mar 31, 2008 IP
  3. megler

    megler Peon

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I have a plugin that will add a post to the page, but the page must be refreshed first. I've had no luck with wp-o-matic (too buggy in WPMU) so I'm using kind of a workaround. It works great, but if I don't have any visitors, then I don't have any posts added.

    So what I wanted was a cron job that would simulate a visitor coming to my homepage - it sounded easy - is it not? :confused:
     
    megler, Mar 31, 2008 IP
  4. NoobieDoobieDo

    NoobieDoobieDo Peon

    Messages:
    1,456
    Likes Received:
    53
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Use wget for the command, it will hit the page and hopefully that will work. Like this :

    wget http://somedomain.com
     
    NoobieDoobieDo, Mar 31, 2008 IP
  5. megler

    megler Peon

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    megler, Mar 31, 2008 IP
  6. NoobieDoobieDo

    NoobieDoobieDo Peon

    Messages:
    1,456
    Likes Received:
    53
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I think so.
     
    NoobieDoobieDo, Mar 31, 2008 IP
  7. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #7
    Edit Contab file

    
    crontab -e
    
    Code (markup):
    Add a new line

    
    0 * * * * php /root/fileadmin
    
    Code (markup):
    Chmod fileadmin to 777, chgrp/chown to current user.

    In the fileadmin file, add the PHP code to update the page.

    Peace,
     
    Barti1987, Mar 31, 2008 IP