Skip to content

Instantly share code, notes, and snippets.

@Sekhmet
Last active August 29, 2015 14:23
Show Gist options
  • Save Sekhmet/3e762bf6927147bf984a to your computer and use it in GitHub Desktop.
Save Sekhmet/3e762bf6927147bf984a to your computer and use it in GitHub Desktop.
Deploy many VZ containers from backup.
#!/bin/bash
for i in {1..126}
do
if [ $(($i%2)) -eq 0 ];
then
vzrestore /var/backup/dump/vzdump-openvz-100-2015_06_26-12_29_41.tar.lzo $(($i + 100)) -storage second
else
vzrestore /var/backup/dump/vzdump-openvz-100-2015_06_26-12_29_41.tar.lzo $(($i + 100))
fi
vzctl set $(($i + 100)) --hostname node$i.muzari.com
vzctl set $(($i + 100)) --ipdel 104.161.36.3 --save
vzctl set $(($i + 100)) --ipadd 104.161.36.$i
#vzctl start $(($i + 100))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment