<?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: archive script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716563#M21501</link>
    <description>that will not work becasue what I am doing is...searching for all files *.log, except for the one currently being written to and zipping everything up except that one.</description>
    <pubDate>Tue, 24 Jan 2006 13:49:33 GMT</pubDate>
    <dc:creator>Ragni Singh</dc:creator>
    <dc:date>2006-01-24T13:49:33Z</dc:date>
    <item>
      <title>archive script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716556#M21494</link>
      <description>Hi all, attached is a script but I need a little bit more help. &lt;BR /&gt;&lt;BR /&gt;ls -l&lt;BR /&gt;&lt;BR /&gt;postgresql-2006-01-15_000000.log     postgresql-2006-01-22_000000.log&lt;BR /&gt;postgresql-2006-01-16_000000.log     postgresql-2006-01-23_000000.log&lt;BR /&gt;postgresql-2006-01-17_000000.log     postgresql-2006-01-24_000000.log&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;find /var/log/pgsql/* -type f -mtime 0 &amp;gt; /tmp/today_files.txt&lt;BR /&gt; &lt;BR /&gt;for a in `find /var/log/pgsql/* -type f -mtime +7`;&lt;BR /&gt; &lt;BR /&gt;do&lt;BR /&gt; &lt;BR /&gt;        IS_TODAY=`grep -c $a /tmp/today_files.txt`&lt;BR /&gt;if [ "$IS_TODAY" = "1" ]; then&lt;BR /&gt; &lt;BR /&gt;        echo "skipping $a"&lt;BR /&gt; &lt;BR /&gt;else&lt;BR /&gt; &lt;BR /&gt;        echo "zipping $a"&lt;BR /&gt;        gzip $a&lt;BR /&gt; &lt;BR /&gt;fi&lt;BR /&gt; &lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;INstead of doign it for all files, I just need to be able to do it to the *.logs. I don't want to keep re-archiving all files. &lt;BR /&gt;&lt;BR /&gt;Also, I would like all files for a single week zipped or tarred into a common file so that we can use logrotate to handle management of these weekly archives for the rotations.&lt;BR /&gt;&lt;BR /&gt;Any help will be greatly appreciated and points will be assigned.</description>
      <pubDate>Tue, 24 Jan 2006 12:47:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716556#M21494</guid>
      <dc:creator>Ragni Singh</dc:creator>
      <dc:date>2006-01-24T12:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: archive script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716557#M21495</link>
      <description>Try something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt; /tmp/filelist.txt&lt;BR /&gt;find /var/log/pgsql/* -type f -mtime 0 &amp;gt; /tmp/today_files.txt&lt;BR /&gt;&lt;BR /&gt;for a in `find /var/log/pgsql/* -type f -mtime +7`;&lt;BR /&gt;&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;IS_TODAY=`grep -c $a /tmp/today_files.txt`&lt;BR /&gt;if [ "$IS_TODAY" = "1" ]; then&lt;BR /&gt;&lt;BR /&gt;echo "skipping $a"&lt;BR /&gt;&lt;BR /&gt;else&lt;BR /&gt;&lt;BR /&gt;echo $a &amp;gt;&amp;gt; /tmp/filelist.txt&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;tar zcvf files.tgz -T /tmp/filelist.txt&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jan 2006 13:05:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716557#M21495</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2006-01-24T13:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: archive script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716558#M21496</link>
      <description>Ivan, but is that just going to do it to the *.logs. My whole goal here is so that it doesn't keep re-archiving the same files.</description>
      <pubDate>Tue, 24 Jan 2006 13:10:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716558#M21496</guid>
      <dc:creator>Ragni Singh</dc:creator>
      <dc:date>2006-01-24T13:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: archive script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716559#M21497</link>
      <description>Simply, replace your find commad with:&lt;BR /&gt;&lt;BR /&gt;find "/var/log/pgsql/*.log"</description>
      <pubDate>Tue, 24 Jan 2006 13:22:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716559#M21497</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2006-01-24T13:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: archive script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716560#M21498</link>
      <description>OH MY!!!! Ignore my last output, the find command sould be like this:&lt;BR /&gt;&lt;BR /&gt;find /var/log/pgsql/ -type f -name "*.log"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I don't know what I was thinking.</description>
      <pubDate>Tue, 24 Jan 2006 13:23:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716560#M21498</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2006-01-24T13:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: archive script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716561#M21499</link>
      <description>I was checking your sample script, your are searching for files older than 7 days, and verifying if the files where created today. You'll never get a match. You should use -mtime -7 instead.&lt;BR /&gt;&lt;BR /&gt;You can also use:&lt;BR /&gt;&lt;BR /&gt;find /var/log/pgsql -name "*.log" -mtime +1 -mtime -7</description>
      <pubDate>Tue, 24 Jan 2006 13:31:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716561#M21499</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2006-01-24T13:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: archive script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716562#M21500</link>
      <description>So, your script could be:&lt;BR /&gt;&lt;BR /&gt;tar zcvf backup.tgz $(find /var/log/pgsql/ -type f -name "*.log" -mtime +1 -mtime -7)</description>
      <pubDate>Tue, 24 Jan 2006 13:33:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716562#M21500</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2006-01-24T13:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: archive script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716563#M21501</link>
      <description>that will not work becasue what I am doing is...searching for all files *.log, except for the one currently being written to and zipping everything up except that one.</description>
      <pubDate>Tue, 24 Jan 2006 13:49:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716563#M21501</guid>
      <dc:creator>Ragni Singh</dc:creator>
      <dc:date>2006-01-24T13:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: archive script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716564#M21502</link>
      <description>How do you know that is in use?, check that "-mtime +1 and mtime -7" will compress all files created since one day until seven days ago, so, today files or used files won't be saved. Isn't that what you where looking for? You can also try using the fuser command to verify if the file is used. Or you can modify your script and mix the commands showed in this thread.</description>
      <pubDate>Tue, 24 Jan 2006 16:04:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/archive-script/m-p/3716564#M21502</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2006-01-24T16:04:40Z</dc:date>
    </item>
  </channel>
</rss>

