Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

CRONJOB to delete auto-generated files

Discussion in 'General Discussion' started by mousepotatoe, Sep 6, 2004.

  1. mousepotatoe

    mousepotatoe Active Member

    Joined:
    Dec 17, 2003
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    156
    I run CRON every 30 minutes on many of my websites that processes the websites scripts, but every time it runs, it creates a file in /home/username/
    as you see below..

    ./ send.php.10 send.php.21 send.php.32 send.php.43 send.php.7
    ../ send.php.11 send.php.22 send.php.33 send.php.44 send.php.8
    .contactemail send.php.12 send.php.23 send.php.34 send.php.45 send.php.9
    .cpanel-ducache send.php.13 send.php.24 send.php.35 send.php.46 .spamkey
    etc/ send.php.14 send.php.25 send.php.36 send.php.47 tmp/
    .lastlogin send.php.15 send.php.26 send.php.37 send.php.48 .trash/
    mail/ send.php.16 send.php.27 send.php.38 send.php.49 www@
    .neomail/ send.php.17 send.php.28 send.php.39 send.php.5
    public_ftp/ send.php.18 send.php.29 send.php.4 send.php.50
    public_html/ send.php.19 send.php.3 send.php.40 send.php.51
    send.php* send.php.2 send.php.30 send.php.41 send.php.52
    send.php.1 send.php.20 send.php.31 send.php.42 send.php.6

    How can i create a single cronjob that will delete these files once a day?
    It would have to be something like
    del /home/*/send.php.*
    but I cant quite figure it out..

    Any help would be appreciated..
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,470
    Likes Received:
    21
    Trophy Points:
    463
    Location:
    Go on, have a guess
    Wouldn't it be better to change the script so that it doesn't create those files?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. mousepotatoe

    mousepotatoe Active Member

    Joined:
    Dec 17, 2003
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    156
    Cronjob to delete files..

    Yes it would be better, but the cron code is encrypted and uneditable by me, so that part is out of my hands.

    :rolleyes:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,470
    Likes Received:
    21
    Trophy Points:
    463
    Location:
    Go on, have a guess
    That would be tricky ;)

    OK, this will do it, but use with extreme care:

    find /home/ -name send.php.* -maxdepth 2 | xargs rm -Rfv

    Probably best to test it beforehand with:

    find /home/ -name send.php.* -maxdepth 2 | xargs ls -la
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. mousepotatoe

    mousepotatoe Active Member

    Joined:
    Dec 17, 2003
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    156
    Excellent!

    Thank you so much, thats perfect :D
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice