5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License, Version 1.0 only
7 # (the "License"). You may not use this file except in compliance
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
27 # Copyright 1997 Sun Microsystems, Inc. All rights reserved.
28 # Use is subject to license terms.
31 #ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */
32 # periodically check the size of /var/adm/pacct
33 # if over $1 blocks (default: maxi 200, mini 500), execute
37 PATH
=/usr
/lib
/acct
:/usr
/bin
:/usr
/sbin
38 trap "rm -f /var/adm/cklock*; exit 0" 0 1 2 3 9 15
50 # set up lock files to prevent simultaneous checking
55 if test $?
-ne 0 ; then exit 1; fi
57 # If there are less than $_MIN_BLKS free blocks left on the /var/adm
58 # file system, turn off the accounting (unless things improve
59 # the accounting wouldn't run anyway). If something has
60 # returned the file system space, restart accounting. This
61 # feature relies on the fact that ckpacct is kicked off by the
62 # cron at least once per hour.
65 _blocks
=`df $_adm | sed 's/.*://' | awk '{ print $1 }'`
67 if [ "$_blocks" -lt $_MIN_BLKS -a -f /tmp
/acctoff
];then
68 echo "ckpacct: $_adm still low on space ($_blocks blks); \c"
69 echo "acctg still off"
70 ( echo "ckpacct: $_adm still low on space ($_blocks blks); \c"
71 echo "acctg still off" ) | mailx root adm
73 elif [ "$_blocks" -lt $_MIN_BLKS ];then
74 echo "ckpacct: $_adm too low on space ($_blocks blks); \c"
75 echo "turning acctg off"
76 ( echo "ckpacct: $_adm too low on space ($_blocks blks); \c"
77 echo "turning acctg off" ) | mailx root adm
81 elif [ -f /tmp
/acctoff
];then
82 echo "ckpacct: $_adm free space restored; turning acctg on"
83 echo "ckpacct: $_adm free space restored; turning acctg on" | \
89 _cursize
="`du -s pacct | sed 's/ .*//'`"
90 if [ "${_max}" -lt "${_cursize}" ]; then