Gary Karbaugh pointed out to me that you can add a -LogoutHook and/or a -LoginHook switch to the console line of the /etc/ttys file. The switch takes an argument that is a full path to whatever script you want to run when you logout. Apple documents this here with an example. In my case the script was to delete /tmp/.X0-lock and /tmp/.X11-unix/, both of which were preventing me from making available X11.app for more than one user, a mysterious bug that plagues some but not others.
I found I had to restart to get it to work, though I imagine there is a more elegant way.

