We are running AIX and need a script to kill a telnet connection by user name. The syntax needs to be EVICT <Login Name>. The script needs to go find all entrys for that user and kill the sessions. There will be two that need to be killed.
The first will be "imsrun" which needs a kill -15
The second is the shell which will need a kill -9
The manual way we do this is:
UID PID PPID C STIME TTY TIME CMD
test 69054 93078 0 07:54:18 pts/13 0:43 imsrun LOGON
test 93078 53140 0 07:54:15 pts/13 0:00 -bsh
kill -15 69054
kill -9 93078
That kills the session. It would also be nice to kill the telnet daemon if possible.
The second part is a script that gets the list of currently logged in users and calls the first script to kill each one except several that need to stay logged in. I also need to know how to schedule this for 23:00 using cron.
Thanks for the help.