I had wondered about something like that for camping. We do something similar with the dumpsters up at Scout Camp. There has been a rather large black bear up there that really enjoys the dumpsters and has literally torn the metal lids off of them, even when locked and latched up in a supposed bear proof manner.

The ranger used a standard agricultural fence charger connected directly to the dumpsters. No bear problems for a month or two now.