Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

is there any way by which we can run utility on logging out.
There is a server which has account of many users. Now If I login to that server I can put utilities in .bashrc, but I want to kill processes automatically ( which were started by me ) when I logged out. So is there any way?
I can only access that server using terminal ( command line utility i.e. no gui access ).

share|improve this question
When you log out, any processes you started as yourself during that session will get killed automatically as you want. There is nothing you have to do to explicitly kill them manually. – devius Feb 11 '12 at 19:29
no they don't, specially background processes and process started with nohup. – Peeyush Feb 12 '12 at 8:54
Can this thread help you?… – brownian Mar 19 '12 at 11:11
up vote 0 down vote accepted

Sure. Make a script that:

  1. invokes the user's shell, which allows them to do whatever they want as usual; and then
  2. runs whatever program you want to run once the shell is finished (the user is "logging out").

Set that script to the the user's login shell. That should do what you want.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.