nextcloudpi/etc/ncp-templates/ncp-metrics.cfg.sh
Tobias Knöppler b675d61e61
Upgrade to PHP 8.1 when installing NC >= 24 (#1554)
* Update nextcloud to 24.0.4
* ncp-update-nc: Upgrade php to version 8.1 when installing NC >= 24
* ncp-update-nc: Use /etc/shadow workaround for installing systemd
* ncp-update-nc: Run nc-limits after php upgrade
* ncp-update-nc: Rollback after failed php upgrade
* ncp-update-nc: Add success message
* ncp-update-nc: Prevent installation of NC >= 24 on debian 10/PHP <= 7.3
* lamp.sh: Install php8.1 from sury.org
* lamp.sh: Use /etc/shadow workaround for installing systemd
* Dockerfile: Install wget, ca-certificates, lsb-release and procps before installing lamp.sh
* Dockerfile: Make sure, ncp-templates are available when installing lamp.sh
* Migrate all scripts to use template for writing opcache.ini and get_nc_config_value for retrieving datadir
* nc-nextcloud.sh Fix crash if nc-datadir has not been installed yet
* opcache.ini.sh: Don't try to get tmpl values from nc-datadir in containers
2022-09-15 17:31:15 +02:00

87 lines
1.5 KiB
Bash

#!/usr/bin/env bash
set -e
set +u
source /usr/local/etc/library.sh
if [[ "$1" == "--defaults" ]]
then
echo "INFO: Restoring template to default settings" >&2
cat <<EOF
{
"backups": []
}
EOF
exit 0
fi
cat <<EOF
{
"backups": [
EOF
NC_BACKUP_DIR="$(
source "${BINDIR}/BACKUPS/nc-backup.sh"
tmpl_get_destination
)"
NC_BACKUP_AUTO_DIR="$(
source "${BINDIR}/BACKUPS/nc-backup-auto.sh"
tmpl_get_destination
)"
if [[ "$NC_BACKUP_DIR" == "$NC_BACKUP_AUTO_DIR" ]]
then
NC_BACKUP_AUTO_DIR=""
fi
NC_BACKUP_PATTERN="nextcloud-bkp_(?P<year>\\\\d{4})(?P<month>\\\\d{2})(?P<day>\\\\d{2})_.*\\\\.tar(\\\\.gz)?"
cat <<EOF
{
"path": "$NC_BACKUP_DIR",
"pattern": "$NC_BACKUP_PATTERN"
}
EOF
[[ -z "$NC_BACKUP_AUTO_DIR" ]] || {
cat <<EOF
,{
"path": "$NC_BACKUP_AUTO_DIR",
"pattern": "$NC_BACKUP_PATTERN"
}
EOF
}
is_docker || {
DATADIR=$( get_nc_config_value datadirectory ) || {
echo -e "ERROR: Could not get data directory. Is NextCloud running?";
return 1;
}
NC_SNAPSHOTS_DIR="$(dirname "$DATADIR")/ncp-snapshots"
NC_SNAPSHOTS_SYNC_DIR="$(
source "${BINDIR}/BACKUPS/nc-snapshot-sync.sh"
if tmpl_is_destination_local
then
tmpl_get_destination
fi
)"
for snap_dir in "$NC_SNAPSHOTS_DIR" "$NC_SNAPSHOTS_SYNC_DIR"
do
[[ -n "$snap_dir" ]] || continue
cat <<EOF
,{
"path": "${snap_dir}",
"pattern": ".*_(?P<year>\\\\d+)-(?P<month>\\\\d+)-(?P<day>\\\\d+)_(?P<hour>\\\\d{2})(?P<minute>\\\\d{2})(?P<second>\\\\d{2})"
}
EOF
done
}
cat <<EOF
]
}
EOF