The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Strange cron problem

Discussion in 'General Discussion' started by thernes, Mar 16, 2008.

  1. thernes

    thernes Active Member

    Joined:
    Dec 29, 2001
    Messages:
    32
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Bodo, Norway
    I have a server where I have set up a couple of accounts. Every time a cron script is run, it creates an empty file of the cron-file in the sites root folder (/home/***/)

    Example

    Let say that I run the following cron command:
    */15 * * * * wget http://www.mysite.com/cronjobs/cleanupscript.php > /dev/null 2>&1

    Every time this runs, a new, empty file, shows up in the site root, so now the site root looks like this;

    cleanupscript.php
    cleanupscript.php.1
    cleanupscript.php.2
    cleanupscript.php.3
    cleanupscript.php.4
    cleanupscript.php.5
    etc.

    Anybody seen this before and know what could be causing this to happen? The cron commands executes just fine, but I really don't want a bunch of empty files in all the root folders.

    thanks,

    T
     
  2. linux-image

    linux-image Well-Known Member

    Joined:
    Jun 8, 2004
    Messages:
    1,192
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    Root Administrator
    what you are doing is downloading the cleanupscript.php from the said URL through wget. this is the reason why the files are populated inside the folder. Also, I do not think the real purpose of the script by the name is done using this wget command. If you want to execute the script at http://www.mysite.com/cronjobs/cleanupscript.php ; then you might want to first find the path to php with the command :

    which php

    from inside the server. This could be /usr/local/bin/php ; and then you can set the cron as

    /usr/local/bin/php /home/USERNAME/public_html/cronjobs/cleanupscript.php

    and there will be no further downloads and your script should execute fine. You may also use lynx; but the method above is teh best considering low apache usage as well.
     
Loading...

Share This Page