We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
Separate backup folder for every user
Separate backup folder for every user
Hi,
Is it possible to have separate backup folder for every user? For example:
/backup/user1/user1.tar.gz
/backup/user2/user2.tar.gz
and etc
Thanks
Is it possible to have separate backup folder for every user? For example:
/backup/user1/user1.tar.gz
/backup/user2/user2.tar.gz
and etc
Thanks
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Separate backup folder for every user
Not a stratightforward task, but if you know bash shell scripting:
1. you may alter the backup script
2. script a new backup routine that suits you.
Easiest of all
3. Run a cron to MOVE the backup sets based on the name to a folder you desire
1. you may alter the backup script
2. script a new backup routine that suits you.
Easiest of all
3. Run a cron to MOVE the backup sets based on the name to a folder you desire
Re: Separate backup folder for every user
Here what I did:
Code: Select all
# 1. Create a script file and open it:
cd ~
touch myvestabackup.sh
chmod 755 myvestabackup.sh
nano myvestabackup.sh
# 2. Add these lines into:
#!/bin/bash
SHELL=/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin
function myvestabackup() {
A=$1
varlen=${#A}
cd /mybackups
if [ ! -d "$A" ]; then
mkdir "$A"
fi
if [ -d "$A" ]; then
cd "$A"
rm "$(ls -t | tail -1)"
fi
cd /backup
for file in *.tar
do
if [[ ${file:0:$varlen} = "$A" ]]; then
mv "$file" "/mybackups/$A"
fi
done
}
myvestabackup user1
myvestabackup user2
# add a new line with function execution for every user you wish at the end of the file
# 3. Make 'mybackups' folder where every user backups will be moved into separate folder named same as user name:
mkdir /mybackups
# 4. Open crontab and add a new cronjob:
crontab -e
10 6 * * 1 /root/myvestabackup.sh
#this script will create a separate folder for every user in /mybackups, remove the last backup file from every separate folder and move the latest backup files from /backup to these separate folders every Monday at 6:10