#! /bin/sh # # Filename: logmeout # # Programmers: Chris Pecoraro, Br. David Carlson # # Date: March 20, 1997 # # If the user is logged in more than once, this script logs the user out # of all but the current one. For use under HP-UX on acad1. FLAG=0 TEMP="/tmp/tmplog.$$" CurrentPID=`who -mT | cut -c 45-49` who -T | grep "^`whoami` " | cut -c 45-49 > "$TEMP" while read pid do if [ $pid -ne $CurrentPID ] then kill -KILL "$pid" && FLAG=1 fi done < "$TEMP" rm "$TEMP" if [ "$FLAG" = "1" ] then echo "You have been logged out from your previous logins." exit 0 else echo "No previous logins were found." exit 1 fi