Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!news From: woodb!scsmo1!don@cs.umd.edu Newsgroups: comp.unix.wizards Subject: (none) Message-ID: <22646@adm.BRL.MIL> Date: 4 Mar 90 06:37:35 GMT Sender: news@adm.BRL.MIL Lines: 49 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@scsmo1.UUCP> From: don@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@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