Advertisement

04.07.2008 at 07:36PM PDT, ID: 23303432
[x]
Attachment Details

Removal of sar files

Asked by oo07 in Bourne Shell (sh)

Tags: HP, HPUX, HPUX11i

Hi,

I have a cronjob (20 * * * *  /usr/lbin/sa/sa1 300 12) that captures sar files and put them into
/var/adm/sa

server@/var/adm/sa>ll
total 1066848
-rw-r--r--   1 root       sys        17555328 Apr  2 00:15 sa01
-rw-r--r--   1 root       sys        17555328 Apr  3 00:15 sa02
-rw-r--r--   1 root       sys        17555328 Apr  4 00:15 sa03
-rw-r--r--   1 root       sys        17555328 Apr  5 00:15 sa04
-rw-r--r--   1 root       sys        17555328 Apr  6 00:15 sa05
-rw-r--r--   1 root       sys        17555328 Apr  7 00:15 sa06
-rw-r--r--   1 root       sys        16275252 Apr  7 22:30 sa07
-rw-r--r--   1 root       sys        17555328 Mar  9 00:15 sa08
-rw-r--r--   1 root       sys        16823856 Mar 10 00:15 sa09
-rw-r--r--   1 root       sys        17555328 Mar 11 00:15 sa10
-rw-r--r--   1 root       sys        17555328 Mar 12 00:15 sa11
-rw-r--r--   1 root       sys        17555328 Mar 13 00:15 sa12
-rw-r--r--   1 root       sys        17555328 Mar 14 00:15 sa13
-rw-r--r--   1 root       sys        17555328 Mar 15 00:15 sa14
-rw-r--r--   1 root       sys        17555328 Mar 16 00:15 sa15
-rw-r--r--   1 root       sys        17555328 Mar 17 00:15 sa16
-rw-r--r--   1 root       sys        17555328 Mar 18 00:15 sa17
-rw-r--r--   1 root       sys        17555328 Mar 19 00:15 sa18
-rw-r--r--   1 root       sys        17555328 Mar 20 00:15 sa19
-rw-r--r--   1 root       sys        17555328 Mar 21 00:15 sa20
-rw-r--r--   1 root       sys        17555328 Mar 22 00:15 sa21
-rw-r--r--   1 root       sys        17555328 Mar 23 00:15 sa22
-rw-r--r--   1 root       sys        17555328 Mar 24 00:15 sa23
-rw-r--r--   1 root       sys        17555328 Mar 25 00:15 sa24
-rw-r--r--   1 root       sys        17555328 Mar 26 00:15 sa25
-rw-r--r--   1 root       sys        17555328 Mar 27 00:15 sa26
-rw-r--r--   1 root       sys        17555328 Mar 28 00:15 sa27
-rw-r--r--   1 root       sys        17555328 Mar 29 00:15 sa28
-rw-r--r--   1 root       sys        17555328 Mar 30 00:15 sa29
-rw-r--r--   1 root       sys        17555328 Mar 31 00:15 sa30
-rw-r--r--   1 root       sys        17555328 Apr  1 00:15 sa31

This filled up var fast. Could you possibly help me create a script to reatin only 2 weeks of sa. I need a script to run in cron so it will check that only 2 weeks of latest data is stored in /var/adm/sa. Older than 2 weeks will be remove from the directory.
Start Free Trial
[+][-]04.07.2008 at 07:43PM PDT, ID: 21302174

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.07.2008 at 07:59PM PDT, ID: 21302238

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.07.2008 at 08:29PM PDT, ID: 21302358

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.07.2008 at 09:05PM PDT, ID: 21302521

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Bourne Shell (sh)
Tags: HP, HPUX, HPUX11i
Sign Up Now!
Solution Provided By: omarfarid
Participating Experts: 2
Solution Grade: B
 
 
[+][-]04.07.2008 at 09:58PM PDT, ID: 21302692

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628