[K12OSN] Multiple logins ???

Martin Woolley sysadmin at handsworth.bham.sch.uk
Wed Sep 22 07:49:52 UTC 2004


On Tuesday 21 Sep 2004 4:33 pm, norbert wrote:
> Hi Martin,
>
> Thanks I'm trying the script but I've run into two problems;
>
> 1) After changeing the paths for linux and adding a ";" and "done"
> please see code
>
> # This user is only allowed a single login instance
> tty=`/usr/bin/tty`     # Get tty to test for multiple login
>
> if /bin/ps -u $LOGNAME | /bin/grep -v UID | /bin/grep -v "${tty##/dev/}" ;
> then
>        /bin/cat <<-EOM >&2
>
>        You already have an active session on this system and you are
>        allowed a single session.  This session will now be closed.
>
>        EOM
>        wait
>        exit
> fi
> done
>
> I saved the script and tried running it alone I get  "line 16: syntax
> error: unexpected end of file" can the error be clarified and corrected
> please as it looks correct ......

Looks to me it is the done causing your problems.  Typical syntax is :-
for f in `ls` ; do
  something
done
 
> Second where do I put this scrip in /etc/profile ? or as an independent
> executable ??

Nup; just chuck the code on the end of /etc/profile.  You should probably 
change the wait to a sleep 2 otherwise your message won't be visible.  You 
should also possibly bypass this code for select users (root might be a good 
one) and be sure to stay logged in while you are fiddling with /etc/profile 
(ie test it using a different console).

-- 
Regards
Martin Woolley
ICT Support
Handsworth Grammar School
Isis Astarte Diana Hecate Demeter Kali Inanna



*************************************************************
This email and any files transmitted with it are confidential
and intended solely for the use of the individual or entity 
to whom they are addressed. If you have received this email 
in error please notify postmaster at bgfl.org

The views expressed within this email are those of the 
individual, and not necessarily those of the organisation
*************************************************************





More information about the K12OSN mailing list