1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Crontab Command

Discussion in 'Site & Server Administration' started by ResaleBroker, Jul 11, 2004.

  1. #1
    I am trying to set up crontab to run a file on my server: http*//www*resalebroker*com/real-estate-books/cronf.php

    I am having trouble writing a successful path to that file. Can anyone help?

    Home Directory: /hsphere/local/home/resale
    CGI Directory: /usr/bin/php -> /usr/bin/php
    PHP: .php

    Thanks!
     
    ResaleBroker, Jul 11, 2004 IP
  2. compar

    compar Peon

    Messages:
    2,705
    Likes Received:
    169
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I haven't got an exact answer for you, but in my experience the best way to find the answer to this question is to try and run the procedure from the command line. When you can make the command execute from there you will have the right path and syntax.
     
    compar, Jul 11, 2004 IP
  3. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #3
    Is your PHP script setup to be able to run from a command line, or just via http?
     
    digitalpoint, Jul 11, 2004 IP
  4. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #4
    Just http.
     
    ResaleBroker, Jul 11, 2004 IP
  5. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #5
    You would want to use something like curl to execute it from the shell then... for example
    /usr/bin/curl http://www.resalebroker.com/real-estate-books/cronf.php
    
    Code (markup):
     
    digitalpoint, Jul 11, 2004 IP
  6. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #6
    That code didn't work. Any ideas?
     
    ResaleBroker, Jul 11, 2004 IP
  7. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #7
    By the way the PHP is cgi-wrapped.
     
    ResaleBroker, Jul 11, 2004 IP
  8. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #8
    If your script is designed to work from a shell, you can do
    /path/to/php http://www.resalebroker.com/real-estate-books/cronf.php
    Code (markup):
     
    digitalpoint, Jul 11, 2004 IP
  9. jarvi

    jarvi Well-Known Member

    Messages:
    127
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #9
    jarvi, Jul 11, 2004 IP
  10. Owlcroft

    Owlcroft Peon

    Messages:
    645
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #10
    In fact, he could use:

    /pathtophp/php -q /pathtoscript/cronf.php
    The problem is that his host will not tell him (if they even understand the question at their tech-support level) what the correct /pathtophp/ and php invocation are. That sorta makes it a little harder. (Or, putting it another way, knowing those two simple things answers the question.) He has turned in, I believe, five "trouble tickets" so far (the "live support" reports "we don't have documentation on that--turn in a trouble ticket and our experienced technical people will answer your problem instantly", thus providing dictionary makers with new definitions for "answer" and "instantly".)

    This should be a heads-up to those who think web hosting is a commodity.

    The /pathtoscript/ is no problem; but the other part is, regrettably, a question that--owing to its particularity (what are the path and the PHP invocation on that server)--no one but his host can answer.
     
    Owlcroft, Jul 11, 2004 IP
  11. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #11
    My host server just sent me this message:
    "Please, don't run your php scripts in cron. That's not a good idea because it overloads a server." :eek:

    Is it me or did I really pick the wrong host?
     
    ResaleBroker, Jul 12, 2004 IP
  12. l0cke

    l0cke Active Member

    Messages:
    178
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    73
    #12
    It depends on how often you run the cronjob and how process intensive it is. Most hosts will allow you to run custom scripts/processes during off hours.
     
    l0cke, Jul 12, 2004 IP
  13. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #13
    This program would be scheduled to run at 1:00 a.m. in the morning daily. I currently run the program manually every day during peak time.
     
    ResaleBroker, Jul 12, 2004 IP
  14. Owlcroft

    Owlcroft Peon

    Messages:
    645
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #14
    It is also noteworthy that the script in question opens a URL, reads the first header line, closes the URL, and exits. Period, the end. Real server-intensive.
     
    Owlcroft, Jul 13, 2004 IP