My father-in-law set up all of his closet lights to turn on and off when the door opens. He used a switch that was apparently designed for that purpose, with a largish contact switch that turned on when pressed.
I'd buy some of these for my house, but I don't know what to call this item, so I can't find it.