How to run script on logout ?

Hi Everybody,
I want to run my own script on logout , i can use .bash_logout file... problem is this will work only for that particular user... i want to know the common file... so that script wil run for all the user...

  1. How to run script on Shutdown ?

Thanks in advance

Anitha

Checkout /etc/bash.bash_logout for logout. What should work of course is using links in /etc/rc.d for the appropriate runlevel 0 and 6 with a K in their name, pointing to a stop script.

Checkout these two links:
Runlevel - Wikipedia, the free encyclopedia
Chapter*7.*The rc.d System

Thanks for ur reply ...

but no such file is available in /etc directory .... can u tel any other way... to do ths...

Just create this file then and try it out. Also telling which OS you use might help.

There are several command to do that

 
/sbin/shutdown
/sbin/poweroff
/sbin/halt 

But you must be a super user to do this, As a normal user you can do only a logout operation , for that you can provide kill -9 -1 , Sending a kill signal to all the process.