I have something similar that I wrote for my own needs and it works good so far, decided to share it here. Although I use it only for VMs not containers as my primary use is from Moonlight client to wake up a couple of VM gaming machines. One could adapt it easelly to handle LXC too ...