home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!Germany.EU.net!urmel.informatik.rwth-aachen.de!uni-paderborn.de!pbhrzx.uni-paderborn.de!q77755
- From: q77755@pbhrzx.uni-paderborn.de (Marcus Hampel 'alias Zenith')
- Newsgroups: alt.sources
- Subject: cfree - look for free console (sh script)
- Date: 25 Jan 93 11:19:13 GMT
- Organization: Uni Paderborn FB 17 Informatik GERMANY
- Lines: 72
- Message-ID: <q77755.727960753@pbhrzx.uni-paderborn.de>
- NNTP-Posting-Host: pbhrzx.uni-paderborn.de
- Keywords: cfree
-
- Hello ...
-
- I have written a small tool to look at multiple consols.
- If you use a multi processor system, look at the comments and use this
- feature (this is much faster).
-
- So long ...
-
- ---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---
- #!/bin/sh
- # cfree - Look for free machines v1.0
- # by Marcus Hampel (q77755@pbhrzx.uni-paderborn.de) Jan 1993
- #
- # usage: cfree <hostname> ...
-
- myhosts=$@
-
- ##############################################################################
- # To use screen attributes
- ##############################################################################
- #invers=`tput smso`
- #normal=`tput rmso`
- inverse=""
- normal=""
-
- ##############################################################################
- # For parallel "sh"
- ##############################################################################
- # PARALLEL=100
-
- for host in $myhosts
- do
- ##############################################################################
- # The next line is for parallel "sh"
- ##############################################################################
- # (
- rup $host|sed 's/.*average: //g;s/,[ 0-9,.]*$//g' >/tmp/frei.rup.$host.$$ &
- rusers -l $host|fgrep console >/tmp/frei.rusers.$host.$$ &
- wait
- set `cat /tmp/frei.rusers.$host.$$` x
- load=`cat /tmp/frei.rup.$host.$$`
- rm -f /tmp/frei.*.$host.$$
- if [ "$2" = "" ]
- then
- echo F $host $load &
- else
- echo B $host $load $1 &
- fi
- ##############################################################################
- # The next line is for parallel "sh"
- ##############################################################################
- # ) &
- done|
- awk '
- BEGIN{print "+------------+----------------+--------------------------------------+-------+"
- print "| Status: | Host: | Wer besetzt den Rechner: | Load: |"
- print "+------------+----------------+--------------------------------------+-------+"}
- $1 == "B"{frei=" Besetzt "
- wer=$4}
- $1 == "F"{frei=invers " Frei !!! " normal
- wer="--------"}
- {printf "| %s | %-14s | %-36s | %5s |\n",frei,$2,wer,$3}
- END{print "+------------+----------------+--------------------------------------+-------+"}
- ' normal="$normal" invers="$invers" -
- ---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---
- --
- | Marcus Hampel, E-Mail: q77755@pbhrzx.uni-paderborn.de, Zenith on IRC |
- | |
- | "Die Taste, die frueher "Control" hiess, wird nun "Strg" genannt, was |
- | unweigerlich die Assoziation hervorruft, der Anwender werde mit dem |
- | Tastaturkabel stranguliert, sobald er diese Teste betaetigt." |
- | (DOS International , 7/90) |
-