Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not killing a parent process

Status
Not open for further replies.

denisl

Technical User
Jun 18, 2001
36
US
Hello,
I am writing a simple AIX korn shell script. The script executes when the user logs on to the system, preventing them from shell access. The script is in their /etc/passwd entry.
Here's the problem:
The script is a menu for operations to check out the server and application. One of the menu options will provide shell access with a password. Once they go through my simple password authentication process the line of code that follows is:
/usr/bin/ksh
which breaks out of the menu and provides shell access.
When you type exit in the shell, it closes the window and does not return to the menu. When I do a ps from the shell prompt the script is still runnning.
Any suggestions how I can get back to my menu?

Thanks!
-Denis
 
is this an X environment? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Yes, this is an xterm window where the script is run.
I tried adding a stanza to the script where it export the users display and launches another xterm window instead of breaking from the existing window to a shell but it still has the same problem. When you type 'exit' in the new shell window it closes the parent window where the menu is running. I tried the following lines in my script.. all unsuccessful:
/usr/bin/xterm
/usr/bin/xterm &
nohup /usr/bin/xterm
nohup /usr/bin/xterm &

My preferred way would be to break to a shell from the existing window this way 'X' does not have to be running on the workstation (ie. NT or Dos telnet).

Thanks,
Denis
 
Hi Denis,

Yeah, that's what I would do as well, run the menu option in the current window and then, when the option finishes, it will just return to the menu.

Like this maybe?

while(1)
do
[tab]# display menu
[tab]# get choice from user
[tab]if [[ $choice = 1 ]]
[tab]then
[tab][tab]xterm # plus whatever commands you need
[tab]fi
done

would that work for you or am I missing something? (it wouldn't be the first time....) Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Mike,
Thanks.. You put me on the right track.
I did something like this:

"8" )
/bin/ksh
until `ps | grep 'ksh' | grep -v 'grep'`
do
advanced_menu
done
;;
"9" )
exit
;;

Seems to have done the trick. When I exit out of the shell it brings me back to the 'advanced_menu' function.
Thank you very much!

-Denis
 
:) Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top