LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to add logout scripts ?? (https://www.linuxquestions.org/questions/linux-general-1/how-to-add-logout-scripts-303578/)

withjigs 03-19-2005 11:47 AM

how to add logout scripts ??
 
hello friends..
i am using fc1 and fc3 distrozzz....
wanted to add a login script and a logout script for all users in our NIS network...
i have added login script in ".bash_profile" file of all users....
but what about logout script ??
".bash_logout" is not working out...

cylix 03-19-2005 12:39 PM

I verified .bash_logout is working on FC3 (was curious to see if it was a bug)

Since you have created these files for those users, do make sure the appropriate permissions are applied. Obviously, read access is necessary, but it appears execute is not as this script is a function of bash.

Here is a default one from /etc/skel

# ~/.bash_logout

# invalidate the gpm selection buffer iff logging out from a
# virtual terminal
if test -x /sbin/consoletype && /sbin/consoletype fg
then if test -r /var/run/gpm.pid && test -d "/proc/$(/bin/cat /var/run/gpm.pid)"
then kill -USR2 "$(/bin/cat /var/run/gpm.pid)"
fi
fi

clear

Though my root one only contains the header and clear. I don't know what would happen if you used #!/bin/bash as the header, but it may not be a good idea. (Though I haven't tested to see what happens... I suspect nothing)

I want a video of Balmer running around screaming, "Permissions, permissions, permission."

withjigs 03-19-2005 11:54 PM

it works when you are using...but dosen't seem to work when you are using xwindow....

i have just added following line for testing

"touch xyz" in .bash_logout

but no file is created when user logs out....

i have already checked permissions...

cylix 03-20-2005 08:52 AM

By doing a touch .xyz without specifying anything, it might be using the CWD env variable (Current working directory) Though if you were in the home directory at the time it shouldn't be an issue.

An Xterm, from X fires off a interactive non-login shell.

No logout scripts will be called in this manner (from bash anyway), typically it only copies the current environment variables and executes .bashrc

To execute xterm as a login shell, use -ls

Other terminals you will have to consult the documentation.


All times are GMT -5. The time now is 09:05 PM.