1) First, place the following line in your [tt].profile[/tt] (assuming Korn shell here)...
[tt]
export ROOTPID=$$
[/tt]
This is to capture the process id of the top level process in the session.
2) Then, in your script where you want to log them out...
[tt]
sync ; sync ; sleep 1
kill -HUP ${ROOTPID}
sleep 3
kill -9 ${ROOTPID}
[/tt]
The first two lines, the sync's, sleep, and first kill, are to try to let the session end nicely, flushing buffers and cleaning up before it dies. The final "kill -9" is the icepick in the forehead kill that terminates the session.
There may be an easier way, this is just what came to mind first.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.