#!/bin/ash

#set -o errexit
#set -o functrace
#set -o xtrace

export BORG_PASSPHRASE='eagle_squeezing_pretender_penny_residency_shifting_scoop_uninvited_bacon_tried'

# job_file=/mnt/user/Backup/repo/Job_list.txt
job_file=/mnt/borg-repository/Job_list.txt
#repo=/mnt/user/Backup/repo
repo=/mnt/borg-repository/
while read -r job_unit; do
    # reading each line
    #job_name='/mnt/borg-repository::'"$job_unit"
    #borg list "/mnt/borg-repository::$job_unit"  #> /mnt/borg-repository/"$job_unit"
    #borg list "/mnt/borg-repository::$job_unit"
    # echo "borgmatic --verbosity 2 list --repository $repo --archive $job_unit"
    borgmatic --verbosity 2 list --repository "$repo" --archive "$job_unit" > "/borg_logs/borgmatic/$job_unit"
    # echo borg list --short "$repo::$job_unit" >> /tmp/borg_jobs.txt
    #borg list "$job_name"  > "/mnt/borg-repository/$job_unit"
    #eval "$job_cmd"
    #echo "/mnt/borg-repository::$job_unit"
    #echo "/mnt/borg-repository/$job_unit"
done < "$job_file"
