![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Red Hat Red Hat is the world's leading open source technology solutions provider with offerings including Red Hat Enterprise Linux (RHEL), Fedora, open source applications, security and systems management, virtualization, and Services Oriented Architecture (SOA) solutions. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Login and logout time of a session | sharif | UNIX for Advanced & Expert Users | 1 | 03-10-2008 05:10 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 |
| sqlplus session being able to see unix variables session within a script | 435 Gavea | Shell Programming and Scripting | 2 | 07-03-2006 10:11 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
How do you logout from a session?
Hello all -
I'm finishing up a script that I wrote. This is what I did: I added some lines to the .bash_profile that will call my startup script: cd $HOME/startup ./startup.scr This startup script will create some directories, move some files, and then startup an application: cd $HOME/applications ./move_some_files ./start_application This is where I need some help: Under Redhat Linux how do I kill the session and log the user out and display the login screen from my script? Thanks! |
|
||||
|
Quote:
Thanks for the responses! I've tried using logout in my script, but it doesn't do anything. I've tried using exit and that doesn't work either. I've also tried starting the app within .bash_profile - as the last line and that won't work either! I was able to kill the session by doing this within my script: declare -r PIDNUM=`ps -ef | grep gnome-session` kill -9 `echo $PIDNUM | cut -d' ' -f2` Here's the kicker: This will work and kill the session thus logging the user out and returning them to the login screen, but only if you're already logged in and run this from the command line. However This doesn't work if the user logs in from the log in screen. The script does indeed take place - files are moved, the application is started, and files are replaced. But, it doesn't end the session - the normal log in procedure takes place i.e. the desktop is setup etc... I'm at a loss here. Thanks. |
|
||||
|
i am having the same problem in regards to exiting UNIX via a menu using the ksh. I want the menu option to log the user out, however the logout command has to be run from the command prompt and wont work from within the script. If u find an answer, I too am in need of it.
|
| Sponsored Links | ||
|
|