New Messages
Please send letters via email to saletter@mfi.com.
From: William Roy (wroy@camden.lmco.com)
Topic: Auto-locking problem
In the April 1996 article on auto-locking by Doug Morris,
the SunOS_kbr
[and] SunOS_msr scripts (from Listing 3) do not seem
to work. The pstat
at the end of each generates multiple values, none of
which vary with
keyboard or mouse input. I am running SunOS 4.1.4 with
Open Windows.
Response from Doug Morris:
Sorry you are having problems. I know the scripts work
with MIT X, but I
do not know about the latest version of Open Windows
- OW could use
different device routing (see below).
The pstat technique will work on any streams device.
I have used it on
tty/pty devices to calculate the number of password
attempts - more than
three attempts resulted in .profile writing a message
to a log and
dissabling access to the id.
SunOS supports a console switch through the ioctl function
KIOCSDIRECT.
If the switch value is 1, then the system keyboard is
serviced by
/dev/kbd; if it is 0, it serviced by the workstation
console device
(usually /dev/console).
The Sun man pages (kbd, kb, console) on this are vague,
but supposedly
when a window system is activated the switch should
be set to 1
(/dev/kbd). The only time I have seen the switch set
to 0 is when the
workstation is in console mode with no windowing system
active. As soon
as MIT X is started, the switch is set to 1.
If the keyboard were not routed to /dev/kbd, the script
and pstat would
exhibit the symptoms you describe - most significantly,
the file table
offset value would not change for /dev/kbd.
A program similar to the attached is the only way I
know of identifying
the routing of the keyboard. If the routing is not to
/dev/kbd, then
modify the scripts to use the workstation console device
instead
(usually /dev/console). Unfortunately, I cannot test
this out because
the workstations I have access are configured with maxuser
values that
break pstat (if the file table size exceeds 10000 pstat
fails).
The second technique described in the article will work
on any X server,
including workstations. I would recommend you use it
instead. It does
not have the OS/configuration dependencies that the
pstat technique has.
Good luck.
/* program to determine keyboard routing */ #include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stream.h>
#include <sys/stropts.h>
#include <sundev/kbio.h>
#include <sundev/kbd.h>
main(argc,argv)
int argc;
char *argv[];
{
int kbr=0, kb;
kb=open("/dev/kbd",O_RDWR);
if(kb < 0) perror("open fail");
ioctl(kb,KIOCGDIRECT,&kbr);
if (kbr == 0) {
printf("keyboard is assigned to workstation console\n");
}
else printf("keyboard is assigned to /dev/kbd\n");
}
Doug Morris
From: Bill Dyer
Subject: A log program that I like! Thanks!
I would like to point out an address change for Tcl/Tk.
It's not longer
at ftp.cs.berkeley.edu. It has been moved to:
ftp.smli.com and resides in /pub/tcl
Thanks for the information. -AA
From: Rich Holoch (holoch@ccnet.com)
Subject: pageme
The following script is in response to the "Automated
System
Administrator's Pager" article in the May 1996
issue - it avoids the
TAP/modem approach and simply sends Internet email to
activate your
pager. It works great, and was easy to write.
pageme - An automatic UNIX paging utility
#!/usr/bin/perl
# pageme - sends E-Mail to recipients for a number of different
# system error conditions.
# Created 7/25/96 by R. Holoch - 90% disk utilization check.
#
sub runoscmd {
open(OS, "$oscmd|") || die "can't run $oscmd: $!";
@osret = <OS>; }
sub chkfs {
foreach $line (@osret) {
@fields = split(/\s+/,$line);
$fs = @fields[5];
if ($fs ne "/proc") {
$used = @fields[4];
# print "$fs $used\n";
chop $used;
if ($used > 90) {
$errcode = 911;
}
}
}
}
$oscmd = "df";
&runoscmd;
&chkfs;
if ($errcode) {
open (MAIL, "|mail rich_holoch\@iplink");
print MAIL $errcode;
close(MAIL);
}
|