Results 1 to 10 of 10
  1. #1
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    Cron Job Question
    I am trying to setup and test a cron job and have what is probably a really simple question for most ABWers. In the 'Command to run' field can I just put the path to the script I want to run?

    For example
    Command to run: h.t.t.p://www.domain.com/path/to/script.php

    Or do I need to know how to run the script with the unix commands?
    Thanks,
    Doug

  2. #2
    Moderator MichaelColey's Avatar
    Join Date
    January 18th, 2005
    Location
    Mansfield, TX
    Posts
    16,232
    You need to run it with Unix commands. /usr/bin/script.pl

    If you absolutely must "run" a web page, take a look at the "lynx" text browser and run it like:

    /path/to/lynx -source h.t.t.p://www.domain.com/path/to/script.php
    Michael Coley
    Amazing-Bargains.com
     Affiliate Tips | Merchant Best Practices | Affiliate Friendly? | Couponing | CPA Networks? | ABW Tips | Activating Affiliates
    "Education is the most powerful weapon which you can use to change the world." Nelson Mandela

  3. #3
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    Quote Originally Posted by MichaelColey
    You need to run it with Unix commands. /usr/bin/script.pl
    The script is a PHP script so can I just put the script in the folder?

    Ex. /usr/bin/myscript.php

    Or does the script have to be a .pl script? I rather learn to do it the right way vs. jumping through hoops to 'get it to run' if you know what I mean.
    Thanks,
    Doug

  4. #4
    Moderator MichaelColey's Avatar
    Join Date
    January 18th, 2005
    Location
    Mansfield, TX
    Posts
    16,232
    I've never thought of PHP as a language that you would use outside of the browser, but it looks like you might be able to if you're using a recent version and the script was designed for it. Perhaps someone who works with PHP can point you in the right direction.

    Where the program/script is doesn't matter. I was just pointing out that you need to run a command line, not a URL.
    Michael Coley
    Amazing-Bargains.com
     Affiliate Tips | Merchant Best Practices | Affiliate Friendly? | Couponing | CPA Networks? | ABW Tips | Activating Affiliates
    "Education is the most powerful weapon which you can use to change the world." Nelson Mandela

  5. #5
    Full Member Code Monkey's Avatar
    Join Date
    June 11th, 2007
    Posts
    337
    I have a cron job that is a PHP script. I have a CRON job set up and the path is /usr/local/bin/php -q /home/xxxxxxxx/domains/xxxxxxxxx.com/public_html/script.php

    I don't know if this is the 'right' way, but it works for me..

  6. #6
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    Ok going to do a setup wish me luck. I'll post my results In about 30 minutes.
    Thanks,
    Doug

  7. #7
    ABW Ambassador Doug247's Avatar
    Join Date
    January 18th, 2005
    Location
    DE USA
    Posts
    931
    Looks like it worked. Here is what I used in the command line.

    /usr/local/bin/php -q /home/<account>/public_html/folder/myscript.php

    Thanks for the input.
    Thanks,
    Doug

  8. #8
    Full Member Code Monkey's Avatar
    Join Date
    June 11th, 2007
    Posts
    337


    Now, we have to find out if this is the 'right way' to do it..

  9. #9
    Affiliate Manager buyjewelry's Avatar
    Join Date
    January 18th, 2005
    Posts
    400
    /usr/local/bin/php is a right way, using lynx as michael suggested above is also a 'correct' way - but can lead to debugging issues that can be avoided if you can write your script to use the first method.

  10. #10
    Affiliate Network Rep Andy_MN's Avatar
    Join Date
    March 18th, 2008
    Location
    Nottingham
    Posts
    23
    You should just be able to in your crontab just add:

    */2 * * * * php /full/location/of/your/file.php

    This will run every 2 mins, hope this helps

  11. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Help setting my cron job!
    By Ricardo Dacosta in forum Programming / Datafeeds / Tools
    Replies: 1
    Last Post: June 19th, 2008, 09:35 AM
  2. Hostgator Cron Job
    By Code Monkey in forum Midnight Cafe'
    Replies: 3
    Last Post: June 2nd, 2008, 08:30 PM
  3. Deleted Cron Job
    By bettylou in forum Programming / Datafeeds / Tools
    Replies: 8
    Last Post: March 27th, 2008, 12:55 AM
  4. Cron job
    By templus in forum ShareASale - SAS
    Replies: 22
    Last Post: July 29th, 2007, 03:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •