What am I doing wron cron ?

Discussion in 'Site & Server Administration' started by a4kata, Mar 18, 2013.

  1. #1
    * * * * * php -q /home/path/file.php >> /home/path/log.txt

    0 * * * * php -q /home/path/file2.php >> /home/path/log2.txt

    Here is my commands I want to run minutely and hourly cron I tried this but is not working. My OS is debian

    My path to cron is /var/spool/cron/crontabs I named the file 'root .
     
    a4kata, Mar 18, 2013 IP
  2. humtuma

    humtuma Notable Member

    Messages:
    1,225
    Likes Received:
    24
    Best Answers:
    3
    Trophy Points:
    250
    #2
    Ask your hosting , please restart/refresh the cron jobs. And not a single hosting allow you to run cron jobs at every minute. Command should be

    php /home/username/public_html/xxx.php
    or
    php -q /home/user_name//public_html/xxx.php
     
    humtuma, Mar 18, 2013 IP
  3. a4kata

    a4kata Member

    Messages:
    48
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    I'm using dedicated server. I remember there was a way to run a cronjon in the ssh console and execute the file instantly in order to try it if it is working. Do you know this method ?
     
    a4kata, Mar 18, 2013 IP
  4. RoseHosting

    RoseHosting Well-Known Member

    Messages:
    230
    Likes Received:
    11
    Best Answers:
    11
    Trophy Points:
    138
    #4
    You should be able to test your PHP scripts via SSH using the following commands:

    php /home/path/file.php >> /home/path/log.txt
    php /home/path/file2.php >> /home/path/log2.txt
     
    RoseHosting, Mar 18, 2013 IP
  5. a4kata

    a4kata Member

    Messages:
    48
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #5
    I tested it manually and it is working but the cron is not running and executing the root.sh file I have set in /var/spool/crontab/ ...
     
    a4kata, Mar 19, 2013 IP
  6. MilesWeb

    MilesWeb Well-Known Member

    Messages:
    869
    Likes Received:
    35
    Best Answers:
    7
    Trophy Points:
    173
    #6
    Do you mean you have set the cron for root.sh file in which the php commands are ? Also, check the logs @ /var/log/cron to see if it shows any errors.
     
    MilesWeb, Apr 2, 2013 IP