]> git.saurik.com Git - apple/system_cmds.git/blob - sadc.tproj/sa2.sh
8bb9bbd6250d49c7f480ee26c29e8c997c181cd5
[apple/system_cmds.git] / sadc.tproj / sa2.sh
1 #!/bin/sh
2 # /usr/lib/sa/sa2.sh
3 # Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
4 #
5 # @APPLE_LICENSE_HEADER_START@
6 #
7 # "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
8 # Reserved. This file contains Original Code and/or Modifications of
9 # Original Code as defined in and that are subject to the Apple Public
10 # Source License Version 1.0 (the 'License'). You may not use this file
11 # except in compliance with the License. Please obtain a copy of the
12 # License at http://www.apple.com/publicsource and read it before using
13 # this file.
14 #
15 # The Original Code and all software distributed under the License are
16 # distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 # FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
20 # License for the specific language governing rights and limitations
21 # under the License."
22 #
23 # @APPLE_LICENSE_HEADER_END@
24 #
25 umask 0022
26 DATE=`/bin/date +%d`
27 RPT=/var/log/sa/sar${DATE}
28 ENDIR=/usr/bin
29 DFILE=/var/log/sa/sa${DATE}
30 [ -f "$DFILE" ] || exit 0
31 cd ${ENDIR}
32 ${ENDIR}/sar $* -f ${DFILE} > ${RPT}
33 /usr/bin/find /var/log/sa \( -name 'sar??' -o -name 'sa??' \) -mtime +7 -exec /bin/rm -f {} \;