SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Guru
    Join Date
    Oct 2001
    Location
    USA
    Posts
    764
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    deleting mail log

    I have a mail log on mys erver that hits about 67mb each month. I would like to set up a cron job to delete th file every two weeks. How would I do that?

    would it be something like

    rm /???/???/???/file.file

  2. #2
    Non-Member Jinx's Avatar
    Join Date
    Apr 2002
    Location
    Nebraska
    Posts
    180
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try making a shell script that is ran by crontab, here is a tutorial for crontabs: http://www.superscripts.com/tutorial/crontab.html

  3. #3
    SitePoint Guru
    Join Date
    Oct 2001
    Location
    USA
    Posts
    764
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can set up a cron job in 2 seconds with webmin...what I need to know is what is the command like to do something like this.

  4. #4
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You probably have logrotate (or a sym link)in your /etc/cron.daily already. You just need to add your maillog to the logrotate.conf file. On my Redhat servers that is in /etc/logrotate.conf

    Check out man logrotate or look around for a tutorial on the web.

  5. #5
    SitePoint Guru
    Join Date
    Oct 2001
    Location
    USA
    Posts
    764
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That still isnt helping me...I just need the cron command to delete a file.

  6. #6
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As was said, look at the manual for logrotate, logrotate does exactly what it says, it rotates log files at set intervals, so if you add the file to logrotate to be rotated every 2 weeks then you don't need to add a cron job.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  7. #7
    SitePoint Guru
    Join Date
    Oct 2001
    Location
    USA
    Posts
    764
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone know how to do that through webmin?

  8. #8
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought you could do it in 2 seconds with Webmin. Guess not?

    There comes a time when learning what you're actually doing might come in handy.
    ----Adopt-a-Sig----
    Your message here!

  9. #9
    SitePoint Guru
    Join Date
    Oct 2001
    Location
    USA
    Posts
    764
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I said I could set up the cron job in 2 seconds with webmin. Never said anything about setting up a log rotate with webmin.

    There comes a time when reading what people are actually writing might come in handy.


Bookmarks

Posting Permissions

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