Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: cronjob problem

  1. #1
    New Coder
    Join Date
    Nov 2004
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    cronjob problem

    Hello

    when I execute a php script using a cronjob in this way

    */5 * * * * /usr/bin/php /usr/local/script/myscript.php

    It works without problem and execute each minutes

    If I use

    */5 * * * * /usr/bin/php /usr/local/script/myscript.php > /dev/null

    it does NOT work ..

    Why ?
    Last edited by graziano; 03-06-2007 at 05:25 PM.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    /dev/null

  • #3
    New Coder
    Join Date
    Nov 2004
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Inigoesdr View Post
    /dev/null
    It was a typo it's already /dev/null

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Check your paths, check permissions, try to run the command from the console minus the "> /dev/null" and see if it gives you an error.

  • #5
    New Coder
    Join Date
    Nov 2004
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The script from command line works without any problem.

    > /dev/null works fine for all other cronjobs .

    I'm going mad , which could be the problem ?

    Thanks

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    cron wont like the > as an output direction, you don't need it anyway ...

    */5 * * * * php /usr/local/script/myscript.php /dev/null
    That will output the result to /dev/null

    good luck

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    In CPanel the default path is already
    /usr/bin/ so you just need to complete it and doing what sir_panels says should work.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

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