Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site turtlevax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!mhuxh!mhuxi!mhuxm!mhuxn!houxm!ihnp4!zehntel!dual!amd!turtlevax!ken From: ken@turtlevax.UUCP (Ken Turkowski) Newsgroups: net.unix-wizards Subject: Shell script to find max available user memory Message-ID: <607@turtlevax.UUCP> Date: Tue, 4-Dec-84 16:25:46 EST Article-I.D.: turtleva.607 Posted: Tue Dec 4 16:25:46 1984 Date-Received: Thu, 6-Dec-84 04:38:43 EST Distribution: net Organization: CADLINC, Inc. @ Menlo Park, CA Lines: 71 This shell script should determine the amount of available physical memory. Please test it out on your system, and mail me any problems and enhancements. ----------------------------------------------------------------- # This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # usermem echo x - usermem cat > "usermem" << '//E*O*F usermem//' #! /bin/sh # This shell script snoops around to find the maximum amount of user memory. # These variables need to be set only if there is no /usr/adm/messages KMEM=/dev/kmem # User needs read access to KMEM # For VAX, CLICKSIZE = 512 bytes # For PDP-11, CLICKSIZE = 64 bytes # For CADLINC 68000, CLICKSIZE = 4096 bytes CLICKSIZE=512 size=0 if [ -r /usr/adm/messages ] # probably the most transportable then size=`grep avail /usr/adm/messages | sed -n '$s/.*[ ]//p'` fi if [ 0$size -le 0 ] # no size in /usr/adm/messages then if [ -r $KMEM ] then if [ -r /vmunix ] then UNIX=/vmunix CLICKSIZE=512 # Probably VAX elif [ -r /unix ] then UNIX=/unix fi size=`echo maxmem/D | adb $UNIX $KMEM | sed -n '$s/.*[ ]//p'` if [ 0$size -le 0 ] then size=`echo physmem/D | adb $UNIX $KMEM | sed -n '$s/.*[ ]//p'` fi size=`expr 0$size '*' $CLICKSIZE` fi fi if [ 0$size -le 0 ] then echo 0 else echo $size fi //E*O*F usermem// echo Possible errors detected by \'sum\' [hopefully none]: temp=/tmp/shar$$ trap "rm -f $temp; exit" 0 1 2 3 15 cat > $temp <<\!!! 33817 1 !!! sum usermem | sed 's=[^ ]*/==' | diff -b $temp - exit 0 -- Ken Turkowski @ CADLINC, Menlo Park, CA UUCP: {amd,decwrl,flairvax,nsc}!turtlevax!ken ARPA: turtlevax!ken@DECWRL.ARPA