LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 10-21-2005, 08:04 AM   #1
bob_man_uk
Member
 
Registered: Jul 2003
Location: Malta
Distribution: Ubuntu/Windows/Mac
Posts: 83

Rep: Reputation: 16
logging off by script or finding PID of session


Hi all,

nice and easy question for you,
i have a menu based script with various options last one on the list is exit (as you do) but it exits to the shell which i dont want, i want it to exit and log off, if there is no easy command for that then how do i find the PID of the current session to kill it?

thanks in advance

MattyG
 
Old 10-21-2005, 09:07 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Current session is "$$" in Bash.
 
Old 10-21-2005, 09:35 AM   #3
bob_man_uk
Member
 
Registered: Jul 2003
Location: Malta
Distribution: Ubuntu/Windows/Mac
Posts: 83

Original Poster
Rep: Reputation: 16
"$$" doesnt give me a propper PID (or the one for my session at least)

who -um gives me what i need now i just need to work out how to get my script to pull the PID from the list

cheers

MattyG
 
Old 10-21-2005, 07:58 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
FWIW, Bash has builtin "logout".
 
Old 10-23-2005, 09:24 AM   #5
bob_man_uk
Member
 
Registered: Jul 2003
Location: Malta
Distribution: Ubuntu/Windows/Mac
Posts: 83

Original Poster
Rep: Reputation: 16
just to let you know the logoff/logout/exit commands dont work from inside the script,

user logs in and this script comes up as soon as they log in, what i want is when they press q the script ends and the whole session logs off! should i post the script maybe im looking in the wrong area
 
Old 10-25-2005, 09:43 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
If you "exec" this script from their shells ~/.bash_login then it should work, right?

should i post the script maybe im looking in the wrong area
If all fails that could help. Rip out parts we don't need to see so we keep focus.
 
Old 10-27-2005, 04:37 AM   #7
bob_man_uk
Member
 
Registered: Jul 2003
Location: Malta
Distribution: Ubuntu/Windows/Mac
Posts: 83

Original Poster
Rep: Reputation: 16
ok i vorrowed the script from here

http://sunsite.uakom.sk/sunworldonli...7-unix101.html

scroll down to

Listing 1: Sample shell script menu

the layout is pretty much the same except i have sub'd in options for programs i want to run instead of what it shows on the site

Quote:
If you "exec" this script from their shells ~/.bash_login then it should work, right?
i dont understand can you explain a little please
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced question: finding pid of an x window PFudd Linux - Software 3 05-31-2005 06:36 PM
how to find the pid of a perl script from shell script toovato Linux - General 1 12-19-2003 07:25 PM
finding pid with program name durden2.0 Linux - Newbie 1 08-04-2003 09:38 PM
Finding the first pid corrierich Linux - General 2 03-06-2003 03:43 AM
finding a PID and killing it tangle Linux - General 3 01-25-2003 11:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 10:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration