Add support for backup nextcloud accounts.

This commit is contained in:
2020-11-16 17:50:13 +01:00
parent da2be27734
commit 8477b08aee
3 changed files with 200 additions and 1 deletions

View File

@ -122,8 +122,12 @@ if [ "X$backup_dirs" = "X" ]; then
found=false
fi
## - Be compartible with older host files, which are missing variables concerning
## - backup nextcloud accounts.
## -
[[ -z "$nextcloud_backup" ]] && nextcloud_backup=false
if [ "$found" = "true" -o "$pgsql_backup" = "true" -o "$mysql_backup" = "true" -o "$disksetting_backup" = "true" ] ; then
if [ "$found" = "true" -o "$pgsql_backup" = "true" -o "$mysql_backup" = "true" -o "$disksetting_backup" = "true" -o "$nextcloud_backup" = "true" ] ; then
begin_h=`date +%H`
begin_m=`date +%M`
@ -350,6 +354,42 @@ if [ "$found" = "true" -o "$pgsql_backup" = "true" -o "$mysql_backup" = "true"
done
fi
if $nextcloud_backup ; then
declare -a nextcloud_account_arr
for _account in $nextcloud_accounts ; do
nextcloud_account_arr+=("$_account")
done
echolog "\nGoing to backup nextcloud accounts.. ( $(date +%H): $($date +%M) h)"
for _val in "${nextcloud_account_arr[@]}" ; do
IFS=';' read -a _val_arr <<< "${_val}"
if [[ "${#_val_arr[@]}" -eq 3 ]] ; then
_server_url="${_val_arr[2]}"
else
_server_url="$nextcloud_server_url"
fi
_server_name="${_server_url#http://}"
_server_name="${_server_name#https://}"
#echo ""
#echo "#_val_arr[@]: ${#_val_arr[@]}"
#echo "_val_arr[0]: ${_val_arr[0]}"
#echo "_val_arr[1]: ${_val_arr[1]}"
#echo "_val_arr[2]: ${_val_arr[2]}"
#echo "_val_arr[3]: ${_val_arr[3]}"
#echo ""
echolog "\n\tBackup nextcloud account '${_val_arr[0]}' from server '$_server_name'"
nc_server_url="$_server_url" \
nc_server_name="$_server_name" \
nc_user="${_val_arr[0]}" \
nc_password="${_val_arr[1]}" \
${script_dir}/nc_accounts_backup.sh
done
fi
if [[ -n "$post_backup_commands" ]]; then
echolog "\nGoing to execute post backup commands.."