FAQ
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.

Thanx

Janez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.centos.org/pipermail/centos/attachments/20091113/04308ac2/attachment.html

Search Discussions

  • Dave Cross at Nov 13, 2009 at 1:30 pm

    2009/11/13 Janez Kosmrlj <postnalista at googlemail.com>:
    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.
    Of course, that's only going to work if the user is using bash as
    their shell. But, given that proviso, that's the right way to do it.

    Is anything in .bash_logout being called?

    Dave...
  • Libor Tomsik at Nov 13, 2009 at 1:53 pm
    Hi,
    I'm using pam_script and scripts in /etc/security/onsessionclose to do
    that job.

    Install pam_script-0.1.7-1.el5.rf

    add into /etc/pam.d/sshd

    session required pam_script.so runas=root expose=1

    And enjoy.

    On Fri, 13 Nov 2009 14:30:01 +0100, Dave Cross wrote:

    2009/11/13 Janez Kosmrlj <postnalista at googlemail.com>:
    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.
    Of course, that's only going to work if the user is using bash as
    their shell. But, given that proviso, that's the right way to do it.

    Is anything in .bash_logout being called?

    Dave...
    _______________________________________________
    CentOS mailing list
    CentOS at centos.org
    http://lists.centos.org/mailman/listinfo/centos


    --
    Libor Tomsik
    VIG Data s.r.o
    Rychtarikova 1
    326 00 Plzen
    Czech Republic
    +420723055117
  • John Doe at Nov 13, 2009 at 1:57 pm
    From: Janez Kosmrlj <postnalista at googlemail.com>
    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...

    JD
  • Les Mikesell at Nov 13, 2009 at 2:35 pm

    John Doe wrote:
    From: Janez Kosmrlj <postnalista at googlemail.com>
    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 at gmail.com
  • R P Herrold at Nov 13, 2009 at 9:35 pm

    On Fri, 13 Nov 2009, Janez Kosmrlj wrote:

    Does anyone have an idea how to run a script when the user logs out.
    same answer as last week: check out inotify

    -- Russ herrold

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcentos @
categoriescentos
postedNov 13, '09 at 1:26p
activeNov 13, '09 at 9:35p
posts6
users6
websitecentos.org
irc#centos

People

Translate

site design / logo © 2021 Grokbase