Quick bash script to restore all OpenVZ dumps

By , 2011-10-05 22:57

This script will read the container ID from the file name, and use it to restore the tgz dump to the same ID on the new OpenVZ/Proxmox server.

Note that this only works if the default name for the vzdumps is kept, and it only works for the next 89 years, because I’m lazy.

Thanks to
http://www.cyberciti.biz/faq/bash-loop-over-file/ and http://bashcurescancer.com/10-steps-to-beautiful-shell-scripts.html

for f in $VZDUMPS
        echo "Restoring $f to $VEID"
        vzrestore $f $VEID

One Response to “Quick bash script to restore all OpenVZ dumps”

  1. James says:
    Google Chrome 30.0.1599.101 Google Chrome 30.0.1599.101 Windows 7 x64 Edition Windows 7 x64 Edition
    Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36


    Thanks for the post. I made a similar restore script myself which I use in my dev environment. It restores the latest backup which can be useful if you take several backups over time.


    Hope this is useful,


Leave a Reply


Custom theme by me. Based on Panorama by Themocracy