<?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: data archive in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322893#M683301</link>
    <description>Bunch of directories and files under one parent directory. I'm using a tool to do the archive but I have to enter the month so I just need help with the logic to know that the data are older than 6 months.&lt;BR /&gt;</description>
    <pubDate>Sun, 14 Dec 2008 01:31:54 GMT</pubDate>
    <dc:creator>maliaka</dc:creator>
    <dc:date>2008-12-14T01:31:54Z</dc:date>
    <item>
      <title>data archive</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322891#M683299</link>
      <description>I need to keep 6 months of data and archive the 7th month everytime the data grows older than 6 months.&lt;BR /&gt;10 points for the best solution!</description>
      <pubDate>Sun, 14 Dec 2008 00:25:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322891#M683299</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2008-12-14T00:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: data archive</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322892#M683300</link>
      <description>Are you talking about a file, a few files, a directory tree, a filesystem, database or a whole system?&lt;BR /&gt;How much data, in Mb?  And archive to what?</description>
      <pubDate>Sun, 14 Dec 2008 00:49:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322892#M683300</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-12-14T00:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: data archive</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322893#M683301</link>
      <description>Bunch of directories and files under one parent directory. I'm using a tool to do the archive but I have to enter the month so I just need help with the logic to know that the data are older than 6 months.&lt;BR /&gt;</description>
      <pubDate>Sun, 14 Dec 2008 01:31:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322893#M683301</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2008-12-14T01:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: data archive</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322894#M683302</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;This will find files older than 180-days and copy them to another directory.  Directory heirarchies are duplicated as necessary:&lt;BR /&gt;&lt;BR /&gt;# cd /srcpath&lt;BR /&gt;# find . -type f -mtime +180|cpio -pudlmv /dstpath&lt;BR /&gt;# find . -type f -mtime +180 -exec rm {} +&lt;BR /&gt;&lt;BR /&gt;The second 'find' removes the files that met the criteria for copy.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Sun, 14 Dec 2008 01:43:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322894#M683302</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-12-14T01:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: data archive</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322895#M683303</link>
      <description>&amp;gt;I just need help with the logic to know that the data is older than 6 months.&lt;BR /&gt;&lt;BR /&gt;On a file by file basis?&lt;BR /&gt;JRF's find command can list just the filenames:&lt;BR /&gt;find . -type f -mtime +180&lt;BR /&gt;&lt;BR /&gt;Note: That is any file not modified in 180 days.</description>
      <pubDate>Sun, 14 Dec 2008 01:51:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322895#M683303</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-12-14T01:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: data archive</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322896#M683304</link>
      <description>Sorry guys but I'm having trouble explaining what I need so let me try again.&lt;BR /&gt;Let's say the timestamp of the parent directory has Dec., the logic will automatically run the archive tool and pass june as the month to archive.&lt;BR /&gt;I'm just having difficulty creating that logic.</description>
      <pubDate>Sun, 14 Dec 2008 02:51:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322896#M683304</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2008-12-14T02:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: data archive</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322897#M683305</link>
      <description>&amp;gt;Let's say the timestamp of the parent directory has Dec., the logic will automatically run the archive tool and pass june as the month to archive.&lt;BR /&gt;&lt;BR /&gt;It's clear now.  :-)&lt;BR /&gt;&lt;BR /&gt;Basically you can use fancy smancy calendar scripts like Clay's caljd.sh:&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1157244" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1157244&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Or you can use a simple shell case to look up the month string and "subtract" 6 months:&lt;BR /&gt;mon=$(ll -d $directory | awk '{print $6}')&lt;BR /&gt;case $mon in &lt;BR /&gt;Jan) mon6="July";;&lt;BR /&gt;Feb) mon6="August";;&lt;BR /&gt;...&lt;BR /&gt;Dec) mon6="June";;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;archive_tool $mon6</description>
      <pubDate>Sun, 14 Dec 2008 04:09:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322897#M683305</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-12-14T04:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: data archive</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322898#M683306</link>
      <description>&lt;!--!*#--&gt;Hi (again):&lt;BR /&gt;&lt;BR /&gt;Here are two rigorous variations of my original theme:&lt;BR /&gt;&lt;BR /&gt;# cat .arch1.sh&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset SRCDIR=/tmp/dummydir1 # change&lt;BR /&gt;typeset DSTDIR=/tmp/dummydir2 # change&lt;BR /&gt;typeset MYLIST=/tmp/mylist.$$&lt;BR /&gt;trap 'rm ${MYLIST}' EXIT&lt;BR /&gt;&lt;BR /&gt;cd ${SRCDIR} || exit 1&lt;BR /&gt;find . -type f -mtime +180 -print &amp;gt; ${MYLIST}&lt;BR /&gt;cat ${MYLIST} | cpio -pudvm ${DSTDIR}&lt;BR /&gt;rm $(&amp;lt;${MYLIST}) 2&amp;gt; /dev/null&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;# cat .arch2.sh&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset SRCDIR=/tmp/dummydir1&lt;BR /&gt;typeset DSTDIR=/tmp/dummydir2&lt;BR /&gt;typeset MYLIST=/tmp/mylist.$$&lt;BR /&gt;trap 'rm ${MYLIST}' EXIT&lt;BR /&gt;&lt;BR /&gt;cd ${SRCDIR} || exit 1&lt;BR /&gt;find . -type f -mtime +180 -print &amp;gt; ${MYLIST}&lt;BR /&gt;&lt;BR /&gt;while read FILE&lt;BR /&gt;do&lt;BR /&gt;    DIR=$(dirname ${FILE})&lt;BR /&gt;    mkdir -p ${DSTDIR}/${DIR}&lt;BR /&gt;    cp -p ${FILE} ${DSTDIR}/${DIR}&lt;BR /&gt;done &amp;lt; ${MYLIST}&lt;BR /&gt;&lt;BR /&gt;rm $(&amp;lt;${MYLIST}) 2&amp;gt; /dev/null&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sun, 14 Dec 2008 14:06:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322898#M683306</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-12-14T14:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: data archive</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322899#M683307</link>
      <description>Dennis,&lt;BR /&gt;&lt;BR /&gt;You got it! &lt;BR /&gt;Now, it gets a little complicated with the year.&lt;BR /&gt;&lt;BR /&gt;From your first example:&lt;BR /&gt;&lt;BR /&gt;Jan) mon6="July";;&lt;BR /&gt;&lt;BR /&gt;How can I get the previous year?</description>
      <pubDate>Mon, 15 Dec 2008 05:00:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322899#M683307</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2008-12-15T05:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: data archive</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322900#M683308</link>
      <description>&amp;gt;it gets a little complicated with the year.  How can I get the previous year?&lt;BR /&gt;&lt;BR /&gt;That's an issue.  Also, by using ll on a directory, you get the time of the last modification.  So if nobody is fiddling in it, the time should be the time the last file was created.&lt;BR /&gt;Also note, if the time on the file is over 6 months old, it is in the Mon Day Year format.  So are you going to run this tool on directories that are less than 6 months?&lt;BR /&gt;&lt;BR /&gt;You could look for the ":" and determine it is the current year.&lt;BR /&gt;Otherwise you could use the following on old files to get the year:&lt;BR /&gt;mon=$(ll -d $directory | awk '{print $6}')&lt;BR /&gt;year=$(ll -d $directory | awk '{print $8}')&lt;BR /&gt;case $mon in&lt;BR /&gt;Jan) mon6="July"; (( year -= 1));;&lt;BR /&gt;...&lt;BR /&gt;Jun) mon6="December"; (( year -= 1));;&lt;BR /&gt;Jul) mon6="January";;&lt;BR /&gt;...&lt;BR /&gt;Dec) mon6="June";;&lt;BR /&gt;esac</description>
      <pubDate>Mon, 15 Dec 2008 06:18:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322900#M683308</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-12-15T06:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: data archive</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322901#M683309</link>
      <description>&lt;!--!*#--&gt;Hi (again):&lt;BR /&gt;&lt;BR /&gt;OK, so you want to examine the last modification timestamp of a directory and deduce the date 6-months ago, adjusted for year boundries.  Use Perl:&lt;BR /&gt;&lt;BR /&gt;# cat ./sixago&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;use Time::Local;&lt;BR /&gt;my $dir = shift;&lt;BR /&gt;die "$0: directory expected\n" unless -d $dir;&lt;BR /&gt;my $moddate = ( stat($dir) )[9];&lt;BR /&gt;my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst )&lt;BR /&gt;    = localtime($moddate);&lt;BR /&gt;my $modtime = timelocal( 0, 0, 0, 15, $mon, $year ) - ( 180 * 86400 );&lt;BR /&gt;print join " ", ( split / /, localtime($modtime) )[ 1, 4 ], "\n";&lt;BR /&gt;1;&lt;BR /&gt;&lt;BR /&gt;...run as:&lt;BR /&gt;&lt;BR /&gt;# ./sixago /directory&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;# touch 02290800 /tmp/mydir&lt;BR /&gt;# ./sixago /tmp/mydir&lt;BR /&gt;Aug 2007&lt;BR /&gt;&lt;BR /&gt;# touch /tmp/mydir&lt;BR /&gt;# ./sixago /tmp/mydir&lt;BR /&gt;Jun 2008&lt;BR /&gt;&lt;BR /&gt;This works by fetching the last modification time (in seconds) for the directory.  This is converted into a month-day-year-time format.  The month and year are used and the day of the month set to 15.  This modified date is then converted back to Epoch seconds and 180-days worth of seconds (one day = 86400 seconds) are subtracted.  The new date in seconds is then converted to a month-day-year-time format and the local month name and year are extracted and returned.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 15 Dec 2008 13:41:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322901#M683309</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-12-15T13:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: data archive</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322902#M683310</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;...and to use the Perl script and return the date to your shell script, simply do:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;./archive_tool $(./sixago /somedirectory)&lt;BR /&gt;&lt;BR /&gt;or:&lt;BR /&gt;&lt;BR /&gt;ARCHDATE=$(./sixago /somedirectory)&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Dec 2008 13:47:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/data-archive/m-p/4322902#M683310</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-12-15T13:47:09Z</dc:date>
    </item>
  </channel>
</rss>

