Update scripts to use rclone -c to use checksums instead of mtime
This commit is contained in:
parent
eec40a23ba
commit
430521d96d
|
@ -34,7 +34,7 @@ if ! jq . "${customer_dir}/users.json" &>/dev/null; then
|
||||||
fi
|
fi
|
||||||
if [[ ${status} -eq 0 ]]; then
|
if [[ ${status} -eq 0 ]]; then
|
||||||
# something is wrong if we cant copy the file in 30 seconds, so we should note that
|
# 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
|
status=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -34,14 +34,14 @@ done
|
||||||
for customer in $(${yq} -r '.singlenodes | .[]' ${commonyaml}); do
|
for customer in $(${yq} -r '.singlenodes | .[]' ${commonyaml}); do
|
||||||
product=2 # Prisplan 2
|
product=2 # Prisplan 2
|
||||||
csv="${csv}
|
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' |
|
grep -E -v '^DATE|^Customer' |
|
||||||
sed 's/$/;'${product}'/')"
|
sed 's/$/;'${product}'/')"
|
||||||
done
|
done
|
||||||
echo "${csv}" >"${aggregatefile}"
|
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"
|
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)
|
cd "${olddir}" || (echo "Could not switch back to old dir" && exit 1)
|
||||||
rmdir "${tempdir}"
|
rmdir "${tempdir}"
|
||||||
|
|
|
@ -16,7 +16,7 @@ echo "${userjson}" | jq . >"${customer_dir}/users.json"
|
||||||
status=${?}
|
status=${?}
|
||||||
if [[ ${status} -eq 0 ]]; then
|
if [[ ${status} -eq 0 ]]; then
|
||||||
# something is wrong if we cant copy the file in 30 seconds, so we should note that
|
# 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
|
status=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -59,11 +59,11 @@ rclone mkdir "${location}:drive-${location}-share"
|
||||||
echo -n "${result1}" >"${outfile1}"
|
echo -n "${result1}" >"${outfile1}"
|
||||||
echo -n "${result2}" >"${outfile2}"
|
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 -c --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 "${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 -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 --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 "${outfile2}" "statistics:drive-storage-report/${customer}-usage/${customer}-latest.csv"
|
||||||
|
|
||||||
rm "${outfile1}"
|
rm "${outfile1}"
|
||||||
rm "${outfile2}"
|
rm "${outfile2}"
|
||||||
|
|
Loading…
Reference in a new issue