borg_exporter: improve hostname deduction
This commit is contained in:
parent
c2fedd4886
commit
457509b217
1 changed files with 5 additions and 1 deletions
|
@ -17,10 +17,14 @@ if [[ -n "${REPOS[*]}" ]] ; then
|
|||
fi >> "$TMP_FILE"
|
||||
|
||||
for repository in "${REPOS[@]}" ; do
|
||||
hostname="$repository"
|
||||
if [[ -n "${HOSTNAMES[@]}" ]] ; then
|
||||
hostname=${HOSTNAMES[$repository]:-$repository}
|
||||
fi
|
||||
if [[ "$hostname" == "$repository" ]] ; then
|
||||
hostname=${hostname/"${REPO_BASE}/"//}
|
||||
hostname=${hostname/"/backup"//}
|
||||
hostname=${hostname//\//}
|
||||
fi
|
||||
index_base="$repository/index"
|
||||
age_seconds="$(( $(date +%s) - $(date +%s -r "$index_base".*) ))"
|
||||
|
|
Loading…
Add table
Reference in a new issue