Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Vesta Web Interface
  • Search

restore multiple accounts

Questions regarding the Web Interface
GUI
Post Reply
  • Print view
Advanced search
4 posts • Page 1 of 1
elicast
Posts: 15
Joined: Mon Jul 20, 2015 12:09 am
Contact:
Contact elicast
Website

restore multiple accounts
  • Quote

Post by elicast » Mon Jul 20, 2015 12:14 am

Anyone know how I can start a function to restore multiple account.

I needed restaruar all accounts and had to edit user name at the command one by one

v-restore-user user user.2015-07-19.tar
v-restore-user user2 user2.2015-07-19.tar

and lost a lot of time, imagine 200 sites to edit this line one by one
Top

tjebbeke
Collaborator
Posts: 783
Joined: Mon May 11, 2015 8:43 am
Contact:
Contact tjebbeke
Website

Os: CentOS 6x
Web: apache + nginx
Re: restore multiple accounts
  • Quote

Post by tjebbeke » Mon Jul 20, 2015 11:13 am

You can create a bash script something like this:

Code: Select all

#!/bin/bash
DATE=$(date +%F)
FILES=$(find /home/backup -name "*$DATE.tar")
for f in $FILES
do
		FILE=$(basename $f)
		USER=$(echo $FILE | cut -f1 -d".")
		echo "v-restore-user $USER $FILE"
                #v-restore-user $USER $FILE
done
exit 0
Top

elicast
Posts: 15
Joined: Mon Jul 20, 2015 12:09 am
Contact:
Contact elicast
Website

Re: restore multiple accounts
  • Quote

Post by elicast » Tue Jul 21, 2015 12:37 am

perfect code, thank you
I'm a difficulty, it just fucniona put all the code in manually terminal

I created a file called restore-all and put in /usr/local/vesta/bin

but give the command sudo /usr/local/vesta/bin/restore-all

says does not exist, some adjustment I can do?
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: restore multiple accounts
  • Quote

Post by skurudo » Wed Oct 23, 2019 9:28 am

A little change in script with date format:

Code: Select all

#!/bin/bash
DATE=$(date +%F %T)
FILES=$(find /backup/ -name "*$DATE.tar")
for f in $FILES
do
                FILE=$(basename $f)
                USER=$(echo $FILE | cut -f1 -d".")
                echo "v-restore-user $USER $FILE"
                v-restore-user $USER $FILE
done
exit 0
Top


Post Reply
  • Print view

4 posts • Page 1 of 1

Return to “Web Interface”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password