Update scripts to use rclone -c to use checksums instead of mtime

This commit is contained in:
Micke Nordin 2023-02-24 10:18:40 +01:00
parent eec40a23ba
commit 430521d96d
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257
4 changed files with 9 additions and 9 deletions

View file

@ -34,7 +34,7 @@ if ! jq . "${customer_dir}/users.json" &>/dev/null; then
fi
if [[ ${status} -eq 0 ]]; then
# something is wrong if we cant copy the file in 30 seconds, so we should note that
if ! timeout 30s rclone copy --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${customer_dir}/users.json" "${base_dir}/${location}/"; then
if ! timeout 30s rclone copy -c --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${customer_dir}/users.json" "${base_dir}/${location}/"; then
status=1
fi
fi

View file

@ -34,14 +34,14 @@ done
for customer in $(${yq} -r '.singlenodes | .[]' ${commonyaml}); do
product=2 # Prisplan 2
csv="${csv}
$(rclone --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies cat "${billingbucket}/${customer}-usage/${customer}-latest.csv" |
$(rclone cat --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${billingbucket}/${customer}-usage/${customer}-latest.csv" |
grep -E -v '^DATE|^Customer' |
sed 's/$/;'${product}'/')"
done
echo "${csv}" >"${aggregatefile}"
rclone copy --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${aggregatefile}" "${aggregatedir}/"
rclone copy -c --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${aggregatefile}" "${aggregatedir}/"
mv "${aggregatefile}" "latest.csv"
rclone move --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "latest.csv" "${latestdir}/"
rclone move -c --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "latest.csv" "${latestdir}/"
cd "${olddir}" || (echo "Could not switch back to old dir" && exit 1)
rmdir "${tempdir}"

View file

@ -16,7 +16,7 @@ echo "${userjson}" | jq . >"${customer_dir}/users.json"
status=${?}
if [[ ${status} -eq 0 ]]; then
# something is wrong if we cant copy the file in 30 seconds, so we should note that
if ! timeout 30s rclone copy --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${customer_dir}/users.json" "${base_dir}/${location}/"; then
if ! timeout 30s rclone copy -c --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${customer_dir}/users.json" "${base_dir}/${location}/"; then
status=1
fi
fi

View file

@ -59,11 +59,11 @@ rclone mkdir "${location}:drive-${location}-share"
echo -n "${result1}" >"${outfile1}"
echo -n "${result2}" >"${outfile2}"
rclone copyto --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${outfile1}" "statistics:drive-storage-report/${customer}-usage/daily/${outfile1}"
rclone copyto --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${outfile2}" "statistics:drive-storage-report/${customer}-usage/daily/${outfile2}"
rclone copyto -c --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${outfile1}" "statistics:drive-storage-report/${customer}-usage/daily/${outfile1}"
rclone copyto -c --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${outfile2}" "statistics:drive-storage-report/${customer}-usage/daily/${outfile2}"
rclone copyto --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${outfile1}" "statistics:drive-storage-report/${customer}-usage/${customer}-latest-detailed.csv"
rclone copyto --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${outfile2}" "statistics:drive-storage-report/${customer}-usage/${customer}-latest.csv"
rclone copyto -c --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${outfile1}" "statistics:drive-storage-report/${customer}-usage/${customer}-latest-detailed.csv"
rclone copyto -c --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${outfile2}" "statistics:drive-storage-report/${customer}-usage/${customer}-latest.csv"
rm "${outfile1}"
rm "${outfile2}"