The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Operating Systems > HP-UX
.
google unix.com




Thread: How to logout
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 06-20-2009
scottn scottn is online now Forum Advisor  
VIP Member
  
 

Join Date: Jun 2009
Location: Zürich, CH
Posts: 1,076
You want the script to logout of UNIX?

In your script...

Code:
kill -9 $PPID
I've never wanted to do this, but it might work...

(it does kinda assume that the parent process is the login one)

Basically you need to find the PID of the "-ksh", "-bash", or whatever process that's your login process - and kill it.

If your want to make sure the script always logs out once it's done, add something like

Code:
trap 'kill -9 $PPID' 0 1 2 9 15 16
to your script (man trap for more details)

Last edited by scottn; 06-20-2009 at 07:00 PM..