I have a theatre PHP application I made which I have automatically run whenever anyone logs into the account 'theatre'. I have done this by adding the line 'php /usr/share/theatre/theatre.php' to '.bash_profile' of the user. This works fine for invoking the script, but I also want it to automatically log out of 'theatre' if a user attempts to close the program. How can this be accomplished? Thanks in advance for your help!