<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: script for deleting log files in Linux in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678817#M20743</link>
    <description>The correct solution is to be found in "man logrotate".&lt;BR /&gt;</description>
    <pubDate>Fri, 25 Nov 2005 17:38:58 GMT</pubDate>
    <dc:creator>Ralf Hildebrandt</dc:creator>
    <dc:date>2005-11-25T17:38:58Z</dc:date>
    <item>
      <title>script for deleting log files in Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678812#M20738</link>
      <description>How to write the shell scripts to delete one month old log files.&lt;BR /&gt;Please let me know the script with example.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Yuva</description>
      <pubDate>Fri, 25 Nov 2005 02:08:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678812#M20738</guid>
      <dc:creator>yuva_mca</dc:creator>
      <dc:date>2005-11-25T02:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: script for deleting log files in Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678813#M20739</link>
      <description>Many ways to do it. man find&lt;BR /&gt;&lt;BR /&gt;find /dir_where_files_reside -type f -mtime +30 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;find /dir_where_files_reside -type d -mtime +30 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Do not use -exec and rm first. Look at files and then delete.&lt;BR /&gt;&lt;BR /&gt;find /dir_where_files_reside -type f -mtime +30 -exec ll -d {} \+&lt;BR /&gt;</description>
      <pubDate>Fri, 25 Nov 2005 02:14:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678813#M20739</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2005-11-25T02:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: script for deleting log files in Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678814#M20740</link>
      <description>You can find those files with find command using -mtime (modified time) +30 (30 days or old). &lt;BR /&gt;&lt;BR /&gt;find &lt;DIRECTORY&gt; -type f -mtime +30 | xargs rm -f&lt;BR /&gt;&lt;BR /&gt;You can create a file with that time stamp and find with -newer option in find command.&lt;BR /&gt;&lt;BR /&gt;# touch [[CC]YY]MMDDhhmm[.SS] file1&lt;BR /&gt;&lt;BR /&gt;Change the time + date settings based on your requirement.&lt;BR /&gt;&lt;BR /&gt;# find &lt;DIRECTORY&gt; -type f -newer file1 | xargs rm -f&lt;BR /&gt;&lt;BR /&gt;hth.&lt;BR /&gt;&lt;/DIRECTORY&gt;&lt;/DIRECTORY&gt;</description>
      <pubDate>Fri, 25 Nov 2005 03:05:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678814#M20740</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-11-25T03:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: script for deleting log files in Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678815#M20741</link>
      <description>Thanks for your effort. Now I am clear to find the files &amp;amp; directory and delete the same.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Yuva</description>
      <pubDate>Fri, 25 Nov 2005 04:47:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678815#M20741</guid>
      <dc:creator>yuva_mca</dc:creator>
      <dc:date>2005-11-25T04:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: script for deleting log files in Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678816#M20742</link>
      <description>You can also use the tmpwatch service included with linux to delete files not accesed in a specific period of time.&lt;BR /&gt;&lt;BR /&gt;See man tmpwatch, the script is located at /etc/cron.daily/tmpwatch.&lt;BR /&gt;&lt;BR /&gt;The good thing with this is that you can tell to tmpwatch to not delete files if are in use.</description>
      <pubDate>Fri, 25 Nov 2005 08:28:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678816#M20742</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2005-11-25T08:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: script for deleting log files in Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678817#M20743</link>
      <description>The correct solution is to be found in "man logrotate".&lt;BR /&gt;</description>
      <pubDate>Fri, 25 Nov 2005 17:38:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678817#M20743</guid>
      <dc:creator>Ralf Hildebrandt</dc:creator>
      <dc:date>2005-11-25T17:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: script for deleting log files in Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678818#M20744</link>
      <description>on the same lines, could you guys please let me know how could mtime be used to delete files that are say 3 hrs old.&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;Raj</description>
      <pubDate>Wed, 07 Dec 2005 11:05:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678818#M20744</guid>
      <dc:creator>raj_sudhan</dc:creator>
      <dc:date>2005-12-07T11:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: script for deleting log files in Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678819#M20745</link>
      <description>Can utilize the logrotate utility.&lt;BR /&gt;&lt;BR /&gt;In the logrotate.conf file you make make specifications based on your wants.</description>
      <pubDate>Wed, 07 Dec 2005 12:13:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678819#M20745</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2005-12-07T12:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: script for deleting log files in Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678820#M20746</link>
      <description>Shalom Yuva,&lt;BR /&gt;&lt;BR /&gt;chkconfig logrotated on&lt;BR /&gt;service logroated on&lt;BR /&gt;&lt;BR /&gt;Configuration files are in /etc/logrotate.d&lt;BR /&gt;&lt;BR /&gt;Pretty well documented.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 07 Dec 2005 12:50:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678820#M20746</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-12-07T12:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: script for deleting log files in Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678821#M20747</link>
      <description>I had seen the above given code. its helpful for me. i have one more doubt.&lt;BR /&gt;&lt;BR /&gt;I have to navigate to each directory from root and display files. Then i have to check delete the files older than 3 months. i can do it with the help of above mentioned code. But i have one more constraint. I have to keep at least 5 later versions though its older than 3 months.&lt;BR /&gt;&lt;BR /&gt;can anyone help me in this regard?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.</description>
      <pubDate>Thu, 08 Dec 2005 23:30:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-for-deleting-log-files-in-linux/m-p/3678821#M20747</guid>
      <dc:creator>Joel Jos</dc:creator>
      <dc:date>2005-12-08T23:30:26Z</dc:date>
    </item>
  </channel>
</rss>

