Restore multiple accounts

From Wiki
Jump to: navigation, search

If you want to restore backups for a server on the command line just run this.

cd /
ln -s /backup/cpbackup/(daily,weekly,monthly) web
cd web
for x in $(ls *.tar.gz | cut -d "." -f 1); do /scripts/restorepkg $x; done
cd ..
rm web

It may help to generate a list of accounts first.

ls /backup/cpbackup/daily/ -lh |awk '/Oct\ 12/ {print $9}' | cut -d "." -f 1 > /home/temp/users.txt
while read user; do /scripts/restorepkg $user; done < /home/temp/users.txt