LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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


Hello,

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
Code:
#! /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,

Cheers,
Pete

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

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

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


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
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


All times are GMT -5. The time now is 03:00 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration