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!

need help with setting up a cron job

Discussion in 'General Discussion' started by positive, Dec 27, 2004.

  1. positive

    positive Member

    Joined:
    Mar 29, 2003
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    151
    I need a cron job that removes files larger than 50mb under the /tmp directory (checking every 10 minutes)


    anyone can help?


    Happy holidays.
     
  2. sleddog

    sleddog Active Member

    Joined:
    Jun 13, 2004
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Labrador, Canada
    You will probably need a script -- in perl or another language that you're familiar with. Basically it would do something like this:

    1. Capture the output of ls -l.
    2. Split that into lines.
    3. Split each line into items - filename, filesize, owner, etc.
    4. For each line, evaluate the filesize item to see if it is greater than the specified limit;
    5. If yes, push the filename onto a new array.
    6. Process the new array, deleting each file it contains.

    But perhaps someone else has ideas....
     
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