Cronjob Help Needed VERY Badly...

Discussion in 'Site & Server Administration' started by FamilyGuy, Jun 13, 2007.

  1. #1
    Okay, heres my setup i have so far....

    I downloaded PuTTY last night, logged in and everything...
    typed crontab -l (to make sure i didn't have any existing cronjobs)
    none were found

    SO
    i procceeded to create the file named "run_cron.pl" with the following data in it:

    */5 * * * * /usr/local/bin/php /home/stevoboi/cgi-bin/tick.php
    (tick.php is a tick file for my online game, needs to run for every 5 minutes, updates all of the players)
    saved to file as "run_cron.pl" and uploaded it to my /home/stevoboi/bin/ directory

    THEN
    i went back to PuTTY and typed this
    cd bin
    ::Went to my /bin/ folder::
    typed
    crontab run_cron.pl
    Surprisingly, it didn't have any errors after i hit enter, and i thought it would work... Well, after every 5 minutes, nothing was happening...

    i added the following to the top of my tick.php page :
    #!/usr/bin/php -q


    i can run the tick.php in the browser and have it META refresh every 300 secs, but that gets old... looking for better more secure way...

    ANY SUGGESTIONS??? I REALLY NEED HELP!
     
    FamilyGuy, Jun 13, 2007 IP
  2. tanfwc

    tanfwc Peon

    Messages:
    579
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Are you logged in as user or root user?

    You should type crontab -e and put the following line.

    */5 * * * * /usr/local/bin/php /home/stevoboi/cgi-bin/tick.php

    After which, type crontab -l to make sure that you have listed it.
     
    tanfwc, Jun 13, 2007 IP
  3. FamilyGuy

    FamilyGuy Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yeah, i have done this, i typed crontab -e

    the ~ suiqqlies on the left ;)

    and added the following line

    */5 * * * * /usr/local/bin/php /home/stevoboi/cgi-bin/tick.php

    and i dont know what the difference is between root user and user...

    i have logged in to my server via PuTTY with my client and username and password, yes, if thats what u mean, but still....

    i typed crontab -l
    and it popped up the line of code..... unfortunately, it dooes nothing... could it be because i have the tick.php to where it outputs the text "Updated <?php echo $player_name; ?>"

    it gives me a list of all the players updated when i view it via browser... could that be a problem with cron?
     
    FamilyGuy, Jun 13, 2007 IP
  4. tanfwc

    tanfwc Peon

    Messages:
    579
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    There is a few cause to your problem.

    1) Cron services is not started
    2) wrong php binary

    You should not output text for cron job.
     
    tanfwc, Jun 13, 2007 IP
  5. FamilyGuy

    FamilyGuy Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    you know what, i think i got it now... lemme check and i'll post further notice :)
     
    FamilyGuy, Jun 13, 2007 IP
  6. FamilyGuy

    FamilyGuy Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    YES!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    I GOT IT!

    thanks for the help! I'm def recommending you guys to others with problems.

    my ticks are now automated through cron, and i love it :D

    this rocks, i'll be sure to post more often here and answer some php/mysql questions :) and i'll def ask ya guys if i have more questions.
     
    FamilyGuy, Jun 13, 2007 IP
  7. tanfwc

    tanfwc Peon

    Messages:
    579
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Most welcome :)

    Rep appreciated :p
     
    tanfwc, Jun 13, 2007 IP
  8. FamilyGuy

    FamilyGuy Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    hey m8s, i was wonderin if i could post a link to my game here for a few days so a few peeps could check it out and lemme know what i need done?

    we've fixed ALOT of bugs in it, and got the cron workin (thanks to you guys)

    just lemme know if its cool, not tryin to compete :p
     
    FamilyGuy, Jun 14, 2007 IP
  9. FamilyGuy

    FamilyGuy Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    how the FUCK do i save a crontab once i type
    crontab -e

    i fuckin forgot and im pissed the fuck off
     
    FamilyGuy, Jun 21, 2007 IP
  10. FamilyGuy

    FamilyGuy Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    nvm i got it
    Ctrl + Shift + O
    Shift + O
    :w
    Ctrl + Shift + O
    Shift + O
    :q
     
    FamilyGuy, Jun 21, 2007 IP
  11. inworx

    inworx Peon

    Messages:
    4,860
    Likes Received:
    201
    Best Answers:
    0
    Trophy Points:
    0
    #11
    FamilyGuy, you're not welcomed here to post abusing language.
     
    inworx, Jun 22, 2007 IP