<?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 script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3259731#M176792</link>
    <description>I have a script which runs Ignite-UX backup every week.&lt;BR /&gt;&lt;BR /&gt;This creates folders like:&lt;BR /&gt;/var/opt/ignite/recovery/2004-03-21,04:08&lt;BR /&gt;/var/opt/ignite/recovery/2004-03-28,04:09&lt;BR /&gt;/var/opt/ignite/recovery/2004-04-04,04:08&lt;BR /&gt;/var/opt/ignite/recovery/2004-04-11,04:09&lt;BR /&gt;/var/opt/ignite/recovery/2004-04-18,04:09&lt;BR /&gt;/var/opt/ignite/recovery/2004-04-25,04:08&lt;BR /&gt;&lt;BR /&gt;I want to write a script which will check the /var/opt/ignite/recovery folder and remove the 2004-XX-XX,0X:XX folder which is dated last month.&lt;BR /&gt;&lt;BR /&gt;Here I would like to remove:&lt;BR /&gt;/var/opt/ignite/recovery/2004-03-21,04:08&lt;BR /&gt;/var/opt/ignite/recovery/2004-03-28,04:09&lt;BR /&gt;&lt;BR /&gt;Thanks,</description>
    <pubDate>Tue, 27 Apr 2004 00:00:06 GMT</pubDate>
    <dc:creator>Sanjiv Sharma_1</dc:creator>
    <dc:date>2004-04-27T00:00:06Z</dc:date>
    <item>
      <title>script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3259731#M176792</link>
      <description>I have a script which runs Ignite-UX backup every week.&lt;BR /&gt;&lt;BR /&gt;This creates folders like:&lt;BR /&gt;/var/opt/ignite/recovery/2004-03-21,04:08&lt;BR /&gt;/var/opt/ignite/recovery/2004-03-28,04:09&lt;BR /&gt;/var/opt/ignite/recovery/2004-04-04,04:08&lt;BR /&gt;/var/opt/ignite/recovery/2004-04-11,04:09&lt;BR /&gt;/var/opt/ignite/recovery/2004-04-18,04:09&lt;BR /&gt;/var/opt/ignite/recovery/2004-04-25,04:08&lt;BR /&gt;&lt;BR /&gt;I want to write a script which will check the /var/opt/ignite/recovery folder and remove the 2004-XX-XX,0X:XX folder which is dated last month.&lt;BR /&gt;&lt;BR /&gt;Here I would like to remove:&lt;BR /&gt;/var/opt/ignite/recovery/2004-03-21,04:08&lt;BR /&gt;/var/opt/ignite/recovery/2004-03-28,04:09&lt;BR /&gt;&lt;BR /&gt;Thanks,</description>
      <pubDate>Tue, 27 Apr 2004 00:00:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3259731#M176792</guid>
      <dc:creator>Sanjiv Sharma_1</dc:creator>
      <dc:date>2004-04-27T00:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3259732#M176793</link>
      <description>Hi Sanjiv,&lt;BR /&gt;&lt;BR /&gt;To get the directory.&lt;BR /&gt;#find /var/opt/ignite/recovery -type d -a -mtime +30 -exec ls -d  {} \;&lt;BR /&gt;&lt;BR /&gt;to delete the direstory &lt;BR /&gt;#find /var/opt/ignite/recovery -type d -a -mtime +30 -exec rm -R {} \;&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Sep 2024 09:19:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3259732#M176793</guid>
      <dc:creator>V.Tamilvanan</dc:creator>
      <dc:date>2024-09-16T09:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3259733#M176794</link>
      <description>Not every month has 30 days. And the FAQ answers to 'How do I print yesterday' cannot be used here. But perl is still my way to go: clean and simple&lt;BR /&gt;&lt;BR /&gt;# date ; perl -MTime::Local -le '@t=localtime;$t[4]--;print scalar localtime timelocal@t'&lt;BR /&gt;Tue Apr 27 08:15:30 CEST 2004&lt;BR /&gt;Sat Mar 27 08:15:30 2004&lt;BR /&gt;&lt;BR /&gt;But this will fail for 31 March, because 31 February does not exist:&lt;BR /&gt;&lt;BR /&gt;# date ; perl -MTime::Local=timelocal_nocheck -le '@t=localtime;$t[4]--;$t[3]=32;print scalar localtime timelocal_nocheck@t'&lt;BR /&gt;Tue Apr 27 08:22:58 CEST 2004&lt;BR /&gt;Thu Apr  1 08:22:58 2004&lt;BR /&gt;&lt;BR /&gt;which forced the date to the 32nd before converting back. If that behaviour is acceptable&lt;BR /&gt;&lt;BR /&gt;# perl -MTime::Local=timelocal_nocheck -e'@t=localtime;$t[4]--;@t=localtime timelocal_nocheck@t;$f=sprintf"%4d-%02d-%02d",1900+$t[5],1+$t[4],$t[3];$file=&amp;lt;$f,* &amp;gt;'&lt;BR /&gt;&lt;BR /&gt;Tue Apr 27 08:15:30 CEST 2004&lt;BR /&gt;Sat Mar 27 08:15:30 2004&lt;BR /&gt;&lt;BR /&gt;Will give you the file with the date last month in $file&lt;BR /&gt;&lt;BR /&gt;If you rather not look at month', but use a fixed 30 day period,&lt;BR /&gt;&lt;BR /&gt;# perl -e'@t=localtime(time-30*86400);$f=sprintf"%4d-%02d-%02d",1900+$t[5],1+$t[4],$t[3];$file=&amp;lt;$f,* &amp;gt;'&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Tue, 27 Apr 2004 01:29:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3259733#M176794</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-04-27T01:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3259734#M176795</link>
      <description>Hi,&lt;BR /&gt;I was just wondering....what would be wrong with this approach:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;# Delete older than current month from FOLDER&lt;BR /&gt;FOLDER=  # path to ignitefolders&lt;BR /&gt;CURRENT_YEAR=$(date +%Y)&lt;BR /&gt;CURRENT_MONTH=$(date +%m)&lt;BR /&gt;DEL_MONTH=""&lt;BR /&gt;DEL_YEAR=""&lt;BR /&gt;# Construct pattern for deletion&lt;BR /&gt;if [ "$CURRENT_MONTH" = "01" ]&lt;BR /&gt;then&lt;BR /&gt;        DEL_MONTH="12"&lt;BR /&gt;else&lt;BR /&gt;        DEL_MONTH=$CURRENT_MONTH&lt;BR /&gt;fi&lt;BR /&gt;if [ "$DEL_MONTH" = "12" ]&lt;BR /&gt;then&lt;BR /&gt;        DEL_YEAR=$(($CURRENT_YEAR - 1 ))&lt;BR /&gt;else&lt;BR /&gt;        DEL_YEAR=$CURRENT_YEAR&lt;BR /&gt;fi&lt;BR /&gt;ls -l  ${FOLDER}/${DEL_YEAR}-${DEL_MONTH}-*&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Tue, 27 Apr 2004 02:10:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3259734#M176795</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2004-04-27T02:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3259735#M176796</link>
      <description>John's solution would work, except for 1 thing: you use CURRENT_MONTH as value for DEL_MONTH.&lt;BR /&gt;&lt;BR /&gt;Change the line DEL_MONTH=$CURRENT_MONTH to&lt;BR /&gt;(( DEL_MONTH = $CURRENT_MONTH - 1 ))&lt;BR /&gt;&lt;BR /&gt;and it will work.</description>
      <pubDate>Tue, 27 Apr 2004 02:28:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3259735#M176796</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-04-27T02:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3259736#M176797</link>
      <description>Hi again,&lt;BR /&gt;Thanks Elmar, you are of course right! Now I wonder how I managed to miss the most important point.&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Tue, 27 Apr 2004 03:17:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/3259736#M176797</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2004-04-27T03:17:09Z</dc:date>
    </item>
  </channel>
</rss>

