The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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



HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
What happens when user logout? yhacks Linux 1 05-16-2008 02:20 AM
Exit or logout kinai UNIX for Dummies Questions & Answers 1 04-14-2008 08:44 AM
.logout sharif SUN Solaris 3 12-24-2007 05:08 AM
.logout help 2dumb Shell Programming and Scripting 3 05-10-2007 11:49 AM
logout zam UNIX for Dummies Questions & Answers 2 12-28-2006 07:23 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-19-2009
manish.s manish.s is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 11
How to logout

Hi

I am using UNIX version.
HP-UX HP-UNIX B.11.00

I am writing a script which on certain condition should logout of unix.

But with exit command i am not able to get this..

Plz suggest how i should logout of the session directly.
  #2 (permalink)  
Old 06-19-2009
rakeshawasthi rakeshawasthi is offline
Registered User
  
 

Join Date: Aug 2004
Location: India
Posts: 379
Code:
kill -9 $$
  #3 (permalink)  
Old 06-19-2009
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,568
Can you explain a little more?
  #4 (permalink)  
Old 06-20-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,163
Try starting the script with an "exec", then "exit" should log you out.
  #5 (permalink)  
Old 06-20-2009
pbillast pbillast is offline
Registered User
  
 

Join Date: Jun 2009
Location: Belgium, Mechelen
Posts: 15
or put an exit in your script
and start your shell with
. script.sh
  #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,033
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 06:00 PM..
  #7 (permalink)  
Old 06-20-2009
pbillast pbillast is offline
Registered User
  
 

Join Date: Jun 2009
Location: Belgium, Mechelen
Posts: 15
And if it is buried under a layer of subshells ...
Code:
kill -9 `ps -o "%P"`
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:32 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0