Re: run script on logout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



John Doe wrote:
> From: Janez Kosmrlj <postnalista@xxxxxxxxxxxxxx>
>> Does anyone have an idea how to run a script when the user logs out.
>> I tried puting the command in the .bash_logout file, but it doesnt work.
> 
> bash man:
>        A  login shell is one whose first character of argument zero is a -, or
>        one started with the --login option.
>        ...
>        When  a  login  shell  exits, bash reads and executes commands from the
>        file ~/.bash_logout, if it exists.
> 
> So, if you run bash and exit, it won't be executed.
> If you run bash --login and exit, it will be executed...
> 
> Also from the man:
>        ~/.bash_profile
>               The personal initialization file, executed for login shells
>        ~/.bashrc
>               The individual per-interactive-shell startup file
> 
> In gnome terminal, there is an option in the profile to force it to a login shell...

A 'trap 0' statement in the user's .profile or .bash_profile should also be 
executed as the login shell terminates.

-- 
   Les Mikesell
    lesmikesell@xxxxxxxxx
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux