How to Execute Shell Script on Logout January 26th, 2014 Sometimes I need to run a cleanup script automatically once I logout from a Linux or UNIX system. I normally use the script to cleanup my own temporary files.