(none)
woodb!scsmo1!don at cs.umd.edu
woodb!scsmo1!don at cs.umd.edu
Sun Mar 4 16:37:35 AEST 1990
Received: by woodb.UUCP (uucp on woodb)
To: mimsy!brl.mil!unix-wiz
Subject: Solo - logins
Received: by scsmo1.UUCP (smail2.5)
id AA03334; 2 Mar 90 14:25:55 CST (Fri)
Subject: Solo - logins
To: woodb!mimsy!brl.mil!unix-wiz (Unix Wizards List)
Date: Fri, 2 Mar 90 14:25:53 CST
X-Mailer: ELM [version 2.2 PL0]
Message-Id: <9003021425.AA03334 at scsmo1.UUCP>
From: don at scsmo1.UUCP (Don Ingli)
In one of my application/logins it is necessary that there be only 1
login running at a time. I wrote this program to echo a 'return code' to see
if the user is logging in to the system solo.
The only 2 ways I know to login is through the login shell and the su command.
Are there any other ways to 'login'?
# solo by Don Ingli
#
# Return codes are as follows:
# 0 = a unique login, no problems
# 1 = id is already logged in, multi-user file editing problems
# 2 = tried to login via the su command from another login
id='train'
if [ "`who am i | awk '{print $1}'`" != $id ]
then # used su to login
echo 2
exit
fi
yn=`who | awk '{print$1}' | fgrep -cx $id`
if [ "1" = "$yn" ]
then # unique login
echo 0
else # already logged in
echo 1
fi
--
DON INGLI-United States Department of Agriculture - Soil Conservation Service
INTERNET: scsmo1!don at uunet.uu.net PHONEnet: 314!875!5344
UUCP(short): uunet!scsmo1!don UUCP(long): uunet!mimsy!woodb!scsmo1!don
These are my opinions. I represent myself.
Who do you think you are, Bjorn Nitmo? David Letterman '90 Catch Phrase
More information about the Comp.unix.wizards
mailing list