How can I make This Cron Job?

Discussion in 'Programming' started by fracekm, Jul 11, 2009.

  1. #1
    Hi I have a Aurora GPT script and it says the following

    5. Create the following cron jobs:
    0 0 * * * GET http://www.domain.com/cron.php?pwd=904910> /dev/null

    0 0 * * 6 GET http://www.domain.com/cron2.php?pwd=904910> /dev/null

    0 0 * * 6 GET http://www.domain.com/cron3.php?pwd=904910>dev/null

    5 0 */2 * * GET http://www.domain.com/pemailcron.php?pwd=904910/dev/null

    */10 * * * * GET http://www.domain.com/pemailcron2.php?pwd=904910> /dev/null

    */5 * * * * GET http://www.domain.com/cron-ad-alert.php?pwd=904910> /dev/null

    0 0 * * * GET http://www.domain.com/cron_adminMailer.php?pwd=904910> /dev/null

    Evertime I put those into where it says cron jobs on my cpanel it never works. What am i doing wrong? thanks
     
    fracekm, Jul 11, 2009 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #2
    what is GET?

    cron scripts run shell commands - this implies you have a linux binary called 'GET' - which - you will find - is not something that comes as standard. perhaps it's implied 'wget' instead? or, if a script called GET was supplied, you must make sure it's in the exported path and chmoded to allow execution first. to test this, best go to your shell (via ssh/rlogin/telnet etc) and just try this as the uid of the cron user:

    GET http://www.domain.com/cron.php?pwd=904910

    if it does not work in the shell, it most certainly won't work in the cron. then try wget instead of get. very odd way of running other cron jobs which listen on port 80... kind of defeats the purpose, the php scripts can also run as shell scripts for the purposes of the cron as well...
     
    dimitar christoff, Jul 12, 2009 IP
    fracekm likes this.
  3. shaileshk

    shaileshk Well-Known Member

    Messages:
    455
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #3
    I know in dream host please let me know which hosting are you using.

    Search in wrodpress : cron demo you will get the demo code for cron job
     
    shaileshk, Jul 12, 2009 IP
  4. fracekm

    fracekm Active Member

    Messages:
    111
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #4
    im using Freebee hosting. Thanks dimitar christoff, ill give that a shot. =) Hopefully it will work. Gave you a good rep =)
     
    fracekm, Jul 14, 2009 IP
  5. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #5
    to be honest, it all depends on your hosting. if you don't have wget - i am surprised you even have cron! an alternative would be lynx instead of wget but you need to escape any params from the shell - try:

    /usr/bin/wget "http://www.domain.com/cron2.php?pwd=904910"
    /usr/bin/lynx "-dump http://www.domain.com/cron2.php?pwd=904910"
    "/usr/bin/lynx -dump http://www.domain.com/cron2.php?pwd=904910"

    etc - somebody more versed with crons ought to say which one is safest.

    find the binaries path... itmay not be /usr/bin, may be /usr/local/bin or /usr/sbin etc.

    also you can use curl to fetch urls but i don't remember the syntax off the top of my head. best- consult the hosting!
     
    dimitar christoff, Jul 14, 2009 IP