Hi everyone,
Is there any way to perform a website backup only via Hestia CLI?
I don’t see it in the documentation but it seems odd that you cannot specify the type since you can restore by type
Regards,
Ade
Hi everyone,
Is there any way to perform a website backup only via Hestia CLI?
I don’t see it in the documentation but it seems odd that you cannot specify the type since you can restore by type
Regards,
Ade
Hi @Ade
No, as far as I know Hestia doesn’t allow to create a backup only for WEB.
If you want to do so from command line, you could play with backup exclusions file to exclude all but WEB.
Example script, it creates a backup of current backup exclusions file for the user, creates a new backup exclusions file excluding all but WEB, performs the user’s backup and restores the original exclusions file.
#!/usr/bin/env bash
rc=0
USER="$1"
if [[ -z "$USER" ]]; then
echo "Usage: $0 user"
exit 1
fi
BIN="/usr/local/hestia/bin"
UDATA="/usr/local/hestia/data/users/$USER"
B_EXC="$UDATA/backup-excludes.conf"
B_EXC_ORI="${B_EXC}.ori"
B_EXC_WEB="${B_EXC}.onlyweb"
echo "Backing up current exclusions file for user $USER"
cp "$B_EXC" "$B_EXC_ORI"
echo "Creating backup exclusions to backup only WEB"
cat <<EOF >"$B_EXC_WEB"
WEB=''
DNS='*'
MAIL='*'
DB='*'
CRON='*'
USER='*'
EOF
"$BIN/v-update-user-backup-exclusions" "$USER" "$B_EXC_WEB"
echo -n "Performing backup (only WEB) for user $USER: "
if result="$("$BIN/v-backup-user" "$USER" 2>&1)"; then
echo "Backup completed"
else
echo "Error: Backup failed"
echo "$result"
rc="1"
fi
echo "Restoring original backup exclusions for user $USER"
"$BIN/v-update-user-backup-exclusions" "$USER" "$B_EXC_ORI"
rm "$B_EXC_ORI"
rm "$B_EXC_WEB"
exit "$rc"
To execute the script, save it with the name you want, give exe perms and add the user as argument.
chmod +x script
./script HereTheHestiaUser
Thank you @sahsanu I’ll give it a try!