Restore many cPanel backups in one go
A small loop that restores every cPanel account backup in a folder, one after another.
From the archive: first published on mohamedsharaf.net in January 2016. Rewritten and checked in 2026; some details may be out of date.
When moving a whole server, you often end up with a folder full of cpmove-*.tar.gz files. Instead of restoring them one by one in WHM, a small loop over SSH does it for you:
cd /home/backups
for f in cpmove-*.tar.gz; do
/scripts/restorepkg "$f"
sleep 30
done
Change /home/backups to your own folder. The short pause between accounts gives the server room to breathe, so a big migration doesn’t turn into a load spike.
Run it inside screen or tmux, so a dropped SSH connection doesn’t stop it halfway, and check each account afterwards.