<?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 Need a clean up script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-a-clean-up-script/m-p/5609667#M640441</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dirctory which has a list of packages (both old and ones which are currently running)-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dir1&amp;gt; ls -ltr&lt;/P&gt;&lt;P&gt;app1-oldpackage&lt;/P&gt;&lt;P&gt;app2-oldpackage&lt;/P&gt;&lt;P&gt;app3-oldpackage&lt;/P&gt;&lt;P&gt;app1-current-package&lt;/P&gt;&lt;P&gt;app2-current-package&lt;/P&gt;&lt;P&gt;app3-current-package&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently run ps -ef |grep &amp;lt;package-name&amp;gt; to find out which are currently running and then rm -fr old-packages to create space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a better way to create a script and cleanup using that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Allan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Apr 2012 05:11:51 GMT</pubDate>
    <dc:creator>allanm77</dc:creator>
    <dc:date>2012-04-05T05:11:51Z</dc:date>
    <item>
      <title>Need a clean up script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-a-clean-up-script/m-p/5609667#M640441</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dirctory which has a list of packages (both old and ones which are currently running)-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dir1&amp;gt; ls -ltr&lt;/P&gt;&lt;P&gt;app1-oldpackage&lt;/P&gt;&lt;P&gt;app2-oldpackage&lt;/P&gt;&lt;P&gt;app3-oldpackage&lt;/P&gt;&lt;P&gt;app1-current-package&lt;/P&gt;&lt;P&gt;app2-current-package&lt;/P&gt;&lt;P&gt;app3-current-package&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently run ps -ef |grep &amp;lt;package-name&amp;gt; to find out which are currently running and then rm -fr old-packages to create space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a better way to create a script and cleanup using that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Allan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 05:11:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-a-clean-up-script/m-p/5609667#M640441</guid>
      <dc:creator>allanm77</dc:creator>
      <dc:date>2012-04-05T05:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need a clean up script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-a-clean-up-script/m-p/5609679#M640442</link>
      <description>&lt;P&gt;If your packages don't contain a file with the current running PID there isn't much else you can do.&lt;/P&gt;&lt;P&gt;Or if you aren't using them, move them into an "OLD" directory, until you know for sure you want to remove them.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 05:28:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-a-clean-up-script/m-p/5609679#M640442</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-04-05T05:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Need a clean up script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-a-clean-up-script/m-p/5610513#M640443</link>
      <description>&lt;P&gt;Hi Dennis,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One thing I missed mentioning here,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do an ls -ltr |awk ... |sort to get a list of packages with that dir, the packages have date/time stamp on them and they get sorted out, I want to delete the packages which are of older timestamp.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Timestamp is of this pattern - &amp;lt;appname&amp;gt;-20120330-143912-456557f3f5b34a8091dcecd69ec123dd&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to delete any packages which are older than the new package.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ls -ltr |awk ... |sort&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appname1-20120330-143912-756557f3f5b34a8091dcecd69ec12423&lt;BR /&gt;Appname1-20120402-173057-e30fc8463a1d444185983ccb6d319c33&lt;/P&gt;&lt;P&gt;Appname1-20120404-182519-c32abb08f0bb4ae0bb887818d5c14022&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appname2-20120402-173057-e30fc8463a1d444185983ccb6d319c33&lt;/P&gt;&lt;P&gt;Appname2-20120404-182519-c32abb08f0bb4ae0bb887818d5c14022&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Allan.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 17:00:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-a-clean-up-script/m-p/5610513#M640443</guid>
      <dc:creator>allanm77</dc:creator>
      <dc:date>2012-04-05T17:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: Need a clean up script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-a-clean-up-script/m-p/5610633#M640444</link>
      <description>&lt;P&gt;I am thinking of using -atime with find to have this taken care of.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do agree that a longer term solution is to push the older packages to differnt fs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Allan.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 20:19:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-a-clean-up-script/m-p/5610633#M640444</guid>
      <dc:creator>allanm77</dc:creator>
      <dc:date>2012-04-05T20:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Need a clean up script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-a-clean-up-script/m-p/5610837#M640445</link>
      <description>&lt;P&gt;&amp;gt;I want to delete any packages which are older than the new package.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming there is a "-" between the app and the timestamp, this should do it:&lt;/P&gt;&lt;P&gt;ls -l | awk '&lt;BR /&gt;BEGIN { prev = ""; app = "" }&lt;BR /&gt;{&lt;BR /&gt;# get appname&lt;BR /&gt;n = split($9, apps, "-")&lt;BR /&gt;if (n == 0) next&amp;nbsp; # total line&lt;BR /&gt;if (n &amp;lt; 2) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; print "problem getting appname for", $9&lt;BR /&gt;&amp;nbsp;&amp;nbsp; next&lt;BR /&gt;}&lt;BR /&gt;appname = apps[1]&lt;BR /&gt;if (appname == app) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; print prev&amp;nbsp; # older&lt;BR /&gt;&amp;nbsp;&amp;nbsp; prev = $9&amp;nbsp;&amp;nbsp; # save&lt;BR /&gt;&amp;nbsp;&amp;nbsp; next&lt;BR /&gt;}&lt;BR /&gt;# ignore prev, since last/only&lt;BR /&gt;app = appname&lt;BR /&gt;prev = $9&lt;BR /&gt;} '&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This prints all but the last of any application group.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2012 04:59:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-a-clean-up-script/m-p/5610837#M640445</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-04-06T04:59:22Z</dc:date>
    </item>
  </channel>
</rss>

