Answer the question
In order to leave comments, you need to log in
How to backup users?
Hello. How can I backup the home directories of all users (backup files in a tar archive) whose login starts with u to the user folder (/home/u%name%/backup) and dump all databases that start with u%name% into this same folder?
Answer the question
In order to leave comments, you need to log in
Get a list of users -
ls -1d /home/u*
Make a script that will perform the actions you need for each received name, and backup the necessary data and run it through for example
ls -1d /home/u* | xargs backup.sh
script, it contains:
generation of user database dumps
generation of a list of user directory names into a temporary file ( + database dump names must also be present in the list).
launching tar with the additional option --files-from *temporary file* (reading the list of the archived to take from the file)
option 2: something like
tar cf backup.tar --anchored --exclude='u*' /home /path/dump_bd
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question