<?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: Housekeeping task in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485194#M363044</link>
    <description>something like&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;function roll&lt;BR /&gt;{ &lt;BR /&gt;   typeset x&lt;BR /&gt;   name=$1&lt;BR /&gt;   set -- $name.[0-9][0-9][0-9][0-9].gz&lt;BR /&gt;   if [ $1 = $name'.[0-9][0-9][0-9][0-9].gz' ]&lt;BR /&gt;   then&lt;BR /&gt;     return 0&lt;BR /&gt;   fi&lt;BR /&gt;   x=${1%.gz}&lt;BR /&gt;   typeset -i y=${x##*.}&lt;BR /&gt;   typeset -i idx=$y&lt;BR /&gt;   while [ $# != 0 ]&lt;BR /&gt;   do&lt;BR /&gt;     x=${1%.gz}&lt;BR /&gt;     y=${x##*.}&lt;BR /&gt;     if [[ y &amp;gt; idx ]]&lt;BR /&gt;     then&lt;BR /&gt;       idx=y&lt;BR /&gt;     fi&lt;BR /&gt;     shift&lt;BR /&gt;   done&lt;BR /&gt;   idx=idx+10001&lt;BR /&gt;   typeset -i idx2=0&lt;BR /&gt;   while [[ $idx != 10000 ]]&lt;BR /&gt;   do &lt;BR /&gt;     idx2=idx-1&lt;BR /&gt;     n1=$name.${idx#1}.gz&lt;BR /&gt;     n2=$name.${idx2#1}.gz&lt;BR /&gt;     if [ -f $n2 ]&lt;BR /&gt;     then&lt;BR /&gt;        mv $n2 $n1&lt;BR /&gt;     fi&lt;BR /&gt;     idx=idx2&lt;BR /&gt;   done     &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;mkdir archive&lt;BR /&gt;find . \( -name archive -prune -type f \) -o -type f -mtime +60 |&lt;BR /&gt;while read a&lt;BR /&gt;do&lt;BR /&gt;  roll archive/$a&lt;BR /&gt;  mv $a archive.0000&lt;BR /&gt;  gzip archive/$a.0000&lt;BR /&gt;done&lt;BR /&gt;and start this in a cron</description>
    <pubDate>Tue, 25 Aug 2009 10:05:09 GMT</pubDate>
    <dc:creator>Laurent Menase</dc:creator>
    <dc:date>2009-08-25T10:05:09Z</dc:date>
    <item>
      <title>Housekeeping task</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485193#M363043</link>
      <description>In my system , there are many large files are generated to the system time by time , I would like to do the housekeeping task to archive the files to keep the server clean but still can let the user to extract the files when they required , can advise if I have below requirement &lt;BR /&gt;&lt;BR /&gt;1) keep the files ( that the creation day is within 2 months ) in the system , remove the files are elder than 2 months .&lt;BR /&gt;2) keep all files that created on monthly end in the system . &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I know tar -zcvf can achive the files and append the files to it , but is it possible also to use tar to keep the files are within 2 months ? if not , what is the best way to do the housekeeping in my case ? thx a lot &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;find . -type f -mtime +60 -exec tar zcvf {} file \;</description>
      <pubDate>Tue, 25 Aug 2009 07:15:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485193#M363043</guid>
      <dc:creator>Son dam bi</dc:creator>
      <dc:date>2009-08-25T07:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Housekeeping task</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485194#M363044</link>
      <description>something like&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;function roll&lt;BR /&gt;{ &lt;BR /&gt;   typeset x&lt;BR /&gt;   name=$1&lt;BR /&gt;   set -- $name.[0-9][0-9][0-9][0-9].gz&lt;BR /&gt;   if [ $1 = $name'.[0-9][0-9][0-9][0-9].gz' ]&lt;BR /&gt;   then&lt;BR /&gt;     return 0&lt;BR /&gt;   fi&lt;BR /&gt;   x=${1%.gz}&lt;BR /&gt;   typeset -i y=${x##*.}&lt;BR /&gt;   typeset -i idx=$y&lt;BR /&gt;   while [ $# != 0 ]&lt;BR /&gt;   do&lt;BR /&gt;     x=${1%.gz}&lt;BR /&gt;     y=${x##*.}&lt;BR /&gt;     if [[ y &amp;gt; idx ]]&lt;BR /&gt;     then&lt;BR /&gt;       idx=y&lt;BR /&gt;     fi&lt;BR /&gt;     shift&lt;BR /&gt;   done&lt;BR /&gt;   idx=idx+10001&lt;BR /&gt;   typeset -i idx2=0&lt;BR /&gt;   while [[ $idx != 10000 ]]&lt;BR /&gt;   do &lt;BR /&gt;     idx2=idx-1&lt;BR /&gt;     n1=$name.${idx#1}.gz&lt;BR /&gt;     n2=$name.${idx2#1}.gz&lt;BR /&gt;     if [ -f $n2 ]&lt;BR /&gt;     then&lt;BR /&gt;        mv $n2 $n1&lt;BR /&gt;     fi&lt;BR /&gt;     idx=idx2&lt;BR /&gt;   done     &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;mkdir archive&lt;BR /&gt;find . \( -name archive -prune -type f \) -o -type f -mtime +60 |&lt;BR /&gt;while read a&lt;BR /&gt;do&lt;BR /&gt;  roll archive/$a&lt;BR /&gt;  mv $a archive.0000&lt;BR /&gt;  gzip archive/$a.0000&lt;BR /&gt;done&lt;BR /&gt;and start this in a cron</description>
      <pubDate>Tue, 25 Aug 2009 10:05:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485194#M363044</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2009-08-25T10:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: Housekeeping task</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485195#M363045</link>
      <description>Create a mountpoint with enough disk and adjust your find statement to include full path and either cp (and later remove) or just move (mv) them to new archive mountpoint.&lt;BR /&gt;Here's one that looks for specific filename, owned by specific user, &amp;amp; over xx days old:&lt;BR /&gt;&lt;BR /&gt;find /dir1/dir2 \( -name -filename* -a -user johndoe \) -mtime +60 -exec mv {} /archive1/dir2 \+&lt;BR /&gt;&lt;BR /&gt;...or you can end it with \; like you have.&lt;BR /&gt;&lt;BR /&gt;Just a thought,&lt;BR /&gt;Rgrds,&lt;BR /&gt;Rita&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 25 Aug 2009 12:01:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485195#M363045</guid>
      <dc:creator>Rita C Workman</dc:creator>
      <dc:date>2009-08-25T12:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Housekeeping task</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485196#M363046</link>
      <description>&lt;BR /&gt;thx replies ,&lt;BR /&gt;&lt;BR /&gt;thx Laurent Menase 's work , but the method seems too complicate for me ..&lt;BR /&gt;&lt;BR /&gt;Laurent Menase , &lt;BR /&gt;&lt;BR /&gt;your method move old file to archive dir , but can it handle the monthly file , if I want to archive the monthly file , what can i do ? thx</description>
      <pubDate>Wed, 26 Aug 2009 06:38:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485196#M363046</guid>
      <dc:creator>Son dam bi</dc:creator>
      <dc:date>2009-08-26T06:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Housekeeping task</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485197#M363047</link>
      <description>what do you mean by archive the monthly files?&lt;BR /&gt;&lt;BR /&gt;do you mean you want to keep all the files archived month/month?</description>
      <pubDate>Wed, 26 Aug 2009 07:24:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485197#M363047</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2009-08-26T07:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Housekeeping task</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485198#M363048</link>
      <description>thx,&lt;BR /&gt;&lt;BR /&gt;thx reply ,&lt;BR /&gt;&lt;BR /&gt;what I want is just to keep the month end files ( eg. 31-Jan , 28-Feb , 31-Mar , 30-Apr , 31-May ... ) &lt;BR /&gt;&lt;BR /&gt;For simply ,  tar command can do this request ?&lt;BR /&gt;&lt;BR /&gt;Thx</description>
      <pubDate>Wed, 26 Aug 2009 07:37:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485198#M363048</guid>
      <dc:creator>Son dam bi</dc:creator>
      <dc:date>2009-08-26T07:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Housekeeping task</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485199#M363049</link>
      <description>can you just draw an example of what your dir hierarchy looks like, and what  would be the result.. and example always worth long explanations&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Aug 2009 09:40:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485199#M363049</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2009-08-26T09:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Housekeeping task</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485200#M363050</link>
      <description>thx reply,&lt;BR /&gt;&lt;BR /&gt;if today is 29-Aug-09 , in the archive , the user can see the files from 29-Jun-09 to 29-Aug-09 and monthly files 31-Jan , 28-Feb , 31-Mar , 30-Apr , 31-May 30-&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if today is 30-Aug-09 , in the archive , the user can see the files from 30-Jun-09 to 30-Aug-09 and monthly files 31-Jan , 28-Feb , 31-Mar , 30-Apr , 31-May 30-&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if today is 31-Aug-09 , in the archive , the user can see the files from 1-Jun-09 to 31-Aug-09 and monthly files 31-Jan , 28-Feb , 31-Mar , 30-Apr , 31-May 30-&lt;BR /&gt;&lt;BR /&gt;if today is 1-Sep-09 , in the archive , the user can see the files from 1-July-09 to 1-Sep-09 and monthly files 31-Jan , 28-Feb , 31-Mar , 30-Apr , 31-May 30-,30-Jun-09 &lt;BR /&gt;&lt;BR /&gt;â  &lt;BR /&gt;â  &lt;BR /&gt;&lt;BR /&gt;if today is 1-Oct-09 , in the archive , the user can see the files from 1-Aug-09 to 1-Oct-09 and monthly files 31-Jan , 28-Feb , 31-Mar , 30-Apr , 31-May 30-,30-Jun-09 , 31-Jul-09&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Aug 2009 02:15:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/housekeeping-task/m-p/4485200#M363050</guid>
      <dc:creator>Son dam bi</dc:creator>
      <dc:date>2009-08-27T02:15:54Z</dc:date>
    </item>
  </channel>
</rss>

