+1 vote
in Web & Google by (77.2k points)
I want to create a bash script to create a backup file for a user in the MyVestCP control panel. The default backup bash script "v-backup-users" creates backups for all users. Is there any way to make it for one particular user?

1 Answer

+1 vote
by (354k points)
selected by
 
Best answer

If you check the "v-backup-users" file, you will find that it iterates over all users created by the admin in the MyVestaCP control panel. You can update the logic to iterate over the users you want to create backups for.

Here are the steps:

  • Create a copy of the file "v-backup-users".
  • In the file, search for the line "for user in $(grep '@' /etc/passwd |cut -f1 -d:); do" in the file.
Replace
for user in $(grep '@' /etc/passwd |cut -f1 -d:); do
with
x_users=('username')
for user in "${x_users[@]}"; do

Here, replace 'username' with your desired username.


...