Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-30-2010, 11:35 AM   #1
LQ Newbie
Registered: Jan 2009
Posts: 6

Rep: Reputation: 0
Writing a custom xsession in Ubuntu that logs out on process end


Im trying to create a custom xsession on Ubuntu 10.04 that will launch nxclient and logout automatically when it closes.

This is what I have so far
#! /bin/sh
/usr/NX/bin/nxclient &
exec xterm
How would I go about altering this script to logout when nxclient closes? To make this more complicated, nxclient spawns a separate process (nxssh) when it logs in and closes itself.

Is it possible for a script to listen for a child process to close and then execute some commands (in this case a logout)?

Apologies if I haven't explained it very well but I'm new to linux scripting

Thanks for reading,


Last edited by pete123456; 08-31-2010 at 05:27 AM. Reason: Slight change for clarity
Old 09-01-2010, 03:40 AM   #2
LQ Guru
Registered: Apr 2005
Posts: 5,818

Rep: Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005Reputation: 1005
maybe something like this?

if [ "$(pidof process_name)" ]
# process was found
# process not found


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
BIND 9 not logging to custom logs skibler1223 Linux - Server 9 05-23-2009 03:30 PM
.xinitrc - nxclient = no go fruitwerks Linux - Desktop 1 05-04-2009 04:51 PM
Problem starting nxclient windsurfer Linux - Desktop 0 11-03-2006 11:57 AM
Unusable fonts in nxclient ethics Linux - Software 1 07-11-2006 04:39 AM
Configure Sound with NXclient Jzarecta Linux - Software 1 01-26-2006 04:28 PM > Forums > Linux Forums > Linux - Newbie

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

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