How to set up automatic closet light?

I have a closet with french doors and i want to have an automatic socket in there... Basically an extension cord that has a button or magnetic switch involved so that when the doors are shut the circuit is disconnected and when the doors open the circuit is connected. I have a socket just outside the closet that i... show more I have a closet with french doors and i want to have an automatic socket in there... Basically an extension cord that has a button or magnetic switch involved so that when the doors are shut the circuit is disconnected and when the doors open the circuit is connected. I have a socket just outside the closet that i would connect it to. I have about $20 to do this. Any help would be great.
Update: I would need this for things other than lights thanks.
2 answers 2