I got a shell script named /root/script.bash. When I logout from root account, I need to run a script named /root/script.bash. Is it possible? If so, how?
Edit $HOME/.bash_logout on CentOS 6 Linux i.e. /root/.bash_logout and put the script. For example:
Append the following line:
Save and close the file. Make sure /root/script.bash set with an executable bit. If not set it using chmod:
chmod +x /root/script.bash
That is all. See