ZSH - '.zlogout' not being run on exit


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ZSH - '.zlogout' not being run on exit
# 1  
Old 06-20-2008
ZSH - '.zlogout' not being run on exit

Hi,

I have a problem with '.zlogout' not being run on Solaris 10.
Here's whats happening.
I remotely log in from a PC running Cygwin/X using a local xterm window and ssh to start a remote 'zsh' shell, version 4.2.5, on a Solaris 10 server.

The Server has KDE installed but as a Window manager is already running on the PC it cannot start KDE correctly. This does not give me a problem as the first xterm which connects to the server will also start 'kicker', the KDE menu bar, which allows me to access all the KDE programs that I need.

I have written a '.zlogout' script which will check to see if there are any 'zsh' sessions remaining. If there are not then it should kill any 'kicker' processes that I own.

The problem comes when I log off the server. The '.zlogout' script does not appear to be run leaving the 'kicker' process running.
I have run the .'zlogout' script manually from a ksh session after starting 'kicker' and it kills it off correctly, therefore there does not appear to anything wrong with the '.zlogout' script itself.

I have set $ZDOTDIR to the directory containing the '.zlogout' script and also placed an 'ls' command with the output re-directed to a file but nothing is being output, which leads me to believe that the '.zlogout' script is not being called.

Does anyone has any ideas of what may be wrong ?

This is the contents of the '.zlogout' file:
Code:
#!/usr/bin/zsh
ls -l > /tmp/t1    
xterm_cnt=$( ps -fu $USER | grep -v grep | grep -wc zsh )
if (( ${xterm_cnt} <= 1 )) ; then
    pkill -U ${USER} kicker
fi

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Iso - remaster script trying to start chroot run commands then exit but host system gets messed up

The script works and creates a modified iso fine until I added the chrootbeg and chrootend functions and executed them. I'm sorry if I did something wrong this is my first post. I uploaded entire bash script for reference or in case you want to run it to debug it is called isoremast.txt. ... (5 Replies)
Discussion started by: paulhoffusa
5 Replies

2. Shell Programming and Scripting

Inner script run and its exit status

Main Script #!/bin/ksh echo "Maimn script" ./clocal/www/web-data/WAS/WebSphere7/scripts/DealerLocator/Scripts/secondscript.ksh echo "$? = status" Sdecond Script #!/bin/ksh echo "In second SCript" exit 1 Output: Maimn script ./testmain.ksh:... (4 Replies)
Discussion started by: dineshaila
4 Replies

3. Shell Programming and Scripting

Run bash command inside zsh script

Hi, I would like to run following code in bash inside a zsh script. (In this case is output unfortunately very different if you run it in zsh). I tried to put "bash" in front of the code but I obtained following error message "bash: do: No such file or directory " eve though I merged the whole... (7 Replies)
Discussion started by: kamcamonty
7 Replies

4. UNIX for Advanced & Expert Users

Need a exit from sftp if its ask for password and continue to run remaining part of script.

Hi I am checking status of sftp in Health check script, sftp command is used to connect the server with secure RSA key, which is successfully get connected most of the time but in some case if RSA key ask for password then I need to exit sftp command after few second and continue to run... (1 Reply)
Discussion started by: ketanraut
1 Replies

5. Shell Programming and Scripting

Need help on how to exit a script run on a server from a remote server

hi, I am using the below line to run a script from remote server(say server A) to another server(say server B). ssh username@servername ksh script name. The issue is the script logs into server B, executes the script on server B, transfers the file to server A but does not exit from... (4 Replies)
Discussion started by: yohasini
4 Replies

6. Shell Programming and Scripting

fuser exit code different when script is run from cron

Hi, I am writing a bash script (running on Centos 5.4) to process video (.MTS) files which may have appeared in a certain directory. The files will be dragged and dropped there from a Windows box using Samba, and the script is to check periodically (i.e. run from cron) whether any new .MTS... (0 Replies)
Discussion started by: Palamedes
0 Replies

7. Shell Programming and Scripting

Exit shell after setting executable to run?

Hi, I have an executable file that has a rather long and tedious process to complete. How would I launch the executable using the shell, and then exit the shell while leaving the executable to run in the background? (1 Reply)
Discussion started by: pcwiz
1 Replies

8. UNIX for Dummies Questions & Answers

Exit from telnet when run Remotely

ssh user@host -q -n 'grep `hostname` /etc/hosts; telnet 10.100.23.45 1234;' When i run this command remotely it is hanging and not giving me the prompt, Can anyone tell me how can I exit a telnet command remotely please. Thanks. (10 Replies)
Discussion started by: venu_nbk
10 Replies

9. Shell Programming and Scripting

background jobs exit status and limit the number of jobs to run

i need to execute 5 jobs at a time in background and need to get the exit status of all the jobs i wrote small script below , i'm not sure this is right way to do it.any ideas please help. $cat run_job.ksh #!/usr/bin/ksh #################################### typeset -u SCHEMA_NAME=$1 ... (1 Reply)
Discussion started by: GrepMe
1 Replies

10. Shell Programming and Scripting

exit value of the last run

I want to get the exit value of the last run. I thought I can use the argument "$?" which supposed to hold the value but I get a syntax error. Is there another way? Thanks (2 Replies)
Discussion started by: didi
2 Replies
Login or Register to Ask a Question