home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
1
/
1985
< prev
next >
Wrap
Internet Message Format
|
1990-12-28
|
2KB
From: davidsen@sixhub.UUCP (Wm E. Davidsen Jr)
Newsgroups: alt.sources
Subject: Screen blanker for SCO Xenix
Message-ID: <2149@sixhub.UUCP>
Date: 23 Oct 90 23:05:35 GMT
Here is a screen blanker for Xenix. It needs some magic escapes in SCO
ANSI consoles, and the "security" in SCO UNIX keeps you from getting any
useful info from who (maybe root will work), but it works well on that
one system.
Select a screen with no getty on it, and this program will change to
that screen and blank it (including the cursor).
#!/bin/sh
# shar: Shell Archiver (v1.27)
#
# Run the following text with /bin/sh to create:
# scrnblank
#
sed 's/^X//' << 'SHAR_EOF' > scrnblank &&
X#!/bin/sh
X
X# blank screen for Xenix (@(#)scrnblank - v1.2, 10/23/90 16:12:22)
X
X# this is the screen number for the blank screen
X# it should not be in use, preferably without a getty,
X# since the cursor is not restored. ie. tty07 would be 7
XBLANK_SCR=7
X
X# This is the time to wait in minutes.
X# It may be set from the command line, too
Xif [ $# -eq 1 ]
Xthen WAIT=$1
Xelse WAIT=5
Xfi #
X
X# Logic:
X# the output of "who -u" is scanned to see if all console
X# logins are over N minutes unused. Then the screen is blanked
X# by setting cursor off and doing a clear screen.
X# This program must be run from a tty
X
Xwho -u |
Xawk '
X$2 ~ /tty[01][0-9]/ {
X # Get the time field
X time=substr($0, 38, 5)
X if (time == "old") continue
X split(time, xtime, ":")
X idle = 60*xtime[1] + xtime[2]
X if (WaitStart < idle) continue
X Active = 1
X}
X
XEND {
X # really ugly way to change screens
X if (!Active) {
X # form the device name
X OutDev=sprintf("/dev/tty%02d", BlankScrn)
X # switch to the screen for blank use
X printf("\r\033[%02dz", BlankScrn-1) > OutDev
X # cursor off, CLS
X printf("\r\033[=14;10C\f", BlankScrn) > OutDev
X }
X}' WaitStart=$WAIT BlankScrn=$BLANK_SCR -
SHAR_EOF
chmod 0555 scrnblank || echo "restore of scrnblank fails"
exit 0
--
bill davidsen - davidsen@sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
sysop *IX BBS and Public Access UNIX
moderator of comp.binaries.ibm.pc and 80386 mailing list
"Stupidity, like virtue, is its own reward" -me