First, I always look for similar topics, but weirdly enough I didn't find anything; maybe I used the wrong search terms. Anyway here's my question.
When a server running OpenVZ (host and 5 containers) is restarted, obviously the containers are restarted too. This causes to erase some important iptables configurations in one of the containers.
My solution is to run a script from the host machine every time the server (unintentionally) restarts.
the easy script should do something like this.
vzctl start 101
sleep 20 secs (?!)
vzctl exec 101 iptables add ....
My question is: where put this 'script.sh' to make sure it runs every time the server (host) is restarted?
PS: my guess is it is better to run the sript from the host instead of the container.
Thanks in advance!!