Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Mar 2003
    Posts
    15

    Default need help with setting up a cron job

    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. #2
    Member sleddog's Avatar
    Join Date
    Jun 2004
    Location
    Labrador, Canada
    Posts
    44

    Default

    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....

Similar Threads & Tags
Similar threads

  1. Setting up a Cron Job
    By carella in forum New User Questions
    Replies: 5
    Last Post: 11-28-2010, 10:46 AM
  2. Help Setting up a Cron Job
    By wczone in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 12-25-2007, 12:58 AM
  3. Help Setting a cPanel Cron Job
    By wczone in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 12-17-2007, 03:48 PM
  4. cron job help
    By mher in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 07-11-2006, 01:33 AM
  5. need help with setting up a cron job
    By positive in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 12-27-2004, 02:11 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube