bugs@cs.psu.edu (12/08/90)
Serial Number: 018E0352 Machine Type: Sun 4/490 O/S Version: SunOS 4.1 Organization: Computer Science Department, The Pennsylvania State University 333 Whitmore Laboratory, University Park, PA 16802 Phone Number: +1 814 865 9723 Description: The accounting scripts which check for the amount of free space are looking at /usr inspite of the fact that the accounting data is in /var/adm. In particular, the ckpacct script will turn off accounting when the /usr partition get full even if /var if empty! N.B - These scripts will fail if /var/adm is mounted on a sepearte partition even after the included patches are applied. Repeat-By: Enable account and fill up the /usr partition. Run ckpacct. Fix: Apply the following patches to ckpacct, runacct, and turnacct: RCS file: RCS/ckpacct,v retrieving revision 1.1 diff -c -r1.1 ckpacct *** /tmp/,RCSt1a27469 Mon Dec 3 14:34:30 1990 --- ckpacct Mon Dec 3 14:31:47 1990 *************** *** 7,13 **** # actual or intended publication of such source code. #ident "@(#)ckpacct.sh 1.5 89/09/06 SMI" /* from S5R3 acct:ckpacct.sh 1.4 */ ! # "periodically check the size of /usr/adm/pacct" # "if over $1 blocks (500) default, execute turnacct switch" # "should be run as adm" --- 7,13 ---- # actual or intended publication of such source code. #ident "@(#)ckpacct.sh 1.5 89/09/06 SMI" /* from S5R3 acct:ckpacct.sh 1.4 */ ! # "periodically check the size of /var/adm/pacct" # "if over $1 blocks (500) default, execute turnacct switch" # "should be run as adm" *************** *** 26,32 **** ln cklock cklock1 if test $? -ne 0 ; then exit 1; fi ! # If there are less than $_MIN_BLKS free blocks left on the /usr # file system, turn off the accounting (unless things improve # the accounting wouldn't run anyway). If something has # returned the file system space, restart accounting. This --- 26,32 ---- ln cklock cklock1 if test $? -ne 0 ; then exit 1; fi ! # If there are less than $_MIN_BLKS free blocks left on the /var # file system, turn off the accounting (unless things improve # the accounting wouldn't run anyway). If something has # returned the file system space, restart accounting. This *************** *** 34,58 **** # cron at least once per hour. sync;sync; ! #_blocks=`df /usr | sed "s/.*: *\([0-9][0-9]*\) blocks.*/\1/"` ! _blocks=`df /usr | awk '{print \$4}' | egrep "[0-9]"` if [ "$_blocks" -lt $_MIN_BLKS -a -f /tmp/acctoff ];then ! echo " ckpacct: /usr still low on space ($_blocks blks);" echo " acctg still off" ! ( echo " ckpacct: /usr still low on space ($_blocks blks);" echo " acctg still off" ) | mail root exit 1 elif [ "$_blocks" -lt $_MIN_BLKS ];then ! echo " ckpacct: /usr too low on space ($_blocks blks);" echo " turning acctg off" ! ( echo " ckpacct: /usr too low on space ($_blocks blks);" echo " turning acctg off" ) | mail root nulladm /tmp/acctoff turnacct off exit 1 elif [ -f /tmp/acctoff ];then ! echo " ckpacct: /usr free space restored; turning acctg on" | \ mail root rm /tmp/acctoff turnacct on --- 34,58 ---- # cron at least once per hour. sync;sync; ! #_blocks=`df /var | sed "s/.*: *\([0-9][0-9]*\) blocks.*/\1/"` ! _blocks=`df /var | awk '{print \$4}' | egrep "[0-9]"` if [ "$_blocks" -lt $_MIN_BLKS -a -f /tmp/acctoff ];then ! echo " ckpacct: /var still low on space ($_blocks blks);" echo " acctg still off" ! ( echo " ckpacct: /var still low on space ($_blocks blks);" echo " acctg still off" ) | mail root exit 1 elif [ "$_blocks" -lt $_MIN_BLKS ];then ! echo " ckpacct: /var too low on space ($_blocks blks);" echo " turning acctg off" ! ( echo " ckpacct: /var too low on space ($_blocks blks);" echo " turning acctg off" ) | mail root nulladm /tmp/acctoff turnacct off exit 1 elif [ -f /tmp/acctoff ];then ! echo " ckpacct: /var free space restored; turning acctg on" | \ mail root rm /tmp/acctoff turnacct on RCS file: RCS/runacct,v retrieving revision 1.1 diff -c -r1.1 runacct *** /tmp/,RCSt1a27474 Mon Dec 3 14:34:43 1990 --- runacct Mon Dec 3 14:32:06 1990 *************** *** 37,50 **** exit 1 fi ! # Check to see if there is enough space in /usr to do nitely accounting # ! ##_blocks=`df /usr | sed "s/.*: *\([0-9][0-9]*\) blocks.*/\1/"` ! _blocks=`df /usr | awk '{print \$4}' | egrep "[0-9]"` if [ "$_blocks" -le $_MIN_BLKS ];then ! echo "runacct: Insufficient space in /usr ($_blocks blks); \c" echo "Terminating procedure" ! ( echo "runacct: Insufficient space in /usr ($_blocks blks); \c" echo "Terminating procedure" ) | \ tee ${_active} | mail root logger -p daemon.err "Terminating procedure" --- 37,50 ---- exit 1 fi ! # Check to see if there is enough space in /var to do nitely accounting # ! ##_blocks=`df /var | sed "s/.*: *\([0-9][0-9]*\) blocks.*/\1/"` ! _blocks=`df /var | awk '{print \$4}' | egrep "[0-9]"` if [ "$_blocks" -le $_MIN_BLKS ];then ! echo "runacct: Insufficient space in /var ($_blocks blks); \c" echo "Terminating procedure" ! ( echo "runacct: Insufficient space in /var ($_blocks blks); \c" echo "Terminating procedure" ) | \ tee ${_active} | mail root logger -p daemon.err "Terminating procedure" *************** *** 388,394 **** # " should be done manually, or just cleanup first" ! # " FILE USAGE: all files in /usr/adm/ac/nite unless specified" # " statefile records progess of runacct" # " lastdate last day runacct ran in date +%m%d format" --- 388,394 ---- # " should be done manually, or just cleanup first" ! # " FILE USAGE: all files in /var/adm/ac/nite unless specified" # " statefile records progess of runacct" # " lastdate last day runacct ran in date +%m%d format" *************** *** 409,415 **** # " daycms ascii daily command summary used by prdaily" # " cms acsii total command summary used by prdaily" ! # " following files in /usr/adm directory" # " fee output from chargefee program" # " pacct active pacct file" --- 409,415 ---- # " daycms ascii daily command summary used by prdaily" # " cms acsii total command summary used by prdaily" ! # " following files in /var/adm directory" # " fee output from chargefee program" # " pacct active pacct file" *************** *** 417,423 **** # " Spacctn.MMDD pacct files for MMDD after SETUP state" # " wtmp active wtmp file" ! # " following files in /usr/adm/acct/sum" # " loginlog output of lastlogin used in prdaily" # " tacct total tacct file for current fiscal" --- 417,423 ---- # " Spacctn.MMDD pacct files for MMDD after SETUP state" # " wtmp active wtmp file" ! # " following files in /var/adm/acct/sum" # " loginlog output of lastlogin used in prdaily" # " tacct total tacct file for current fiscal" RCS file: RCS/turnacct,v retrieving revision 1.1 diff -c -r1.1 turnacct *** /tmp/,RCSt1a27479 Mon Dec 3 14:34:51 1990 --- turnacct Mon Dec 3 14:32:12 1990 *************** *** 11,19 **** # "turnacct on makes sure it's on" # "turnacct off turns it off" # "turnacct switch switches pacct to pacct?, starts fresh one" ! # "/usr/adm/pacct is always the current pacct file" PATH=/usr/lib/acct:/bin:/usr/bin:/etc ! cd /usr/adm case "$1" in on) if test ! -r pacct --- 11,19 ---- # "turnacct on makes sure it's on" # "turnacct off turns it off" # "turnacct switch switches pacct to pacct?, starts fresh one" ! # "/var/adm/pacct is always the current pacct file" PATH=/usr/lib/acct:/bin:/usr/bin:/etc ! cd /var/adm case "$1" in on) if test ! -r pacct