Ensure atomic write to the output file
This commit is contained in:
parent
4645874c82
commit
e68569bc81
1 changed files with 3 additions and 1 deletions
|
|
@ -21,11 +21,13 @@ extension="${picture_url##*.}"
|
|||
filename="${picture_date}.${extension}"
|
||||
outfile="${WALLPAPERS}/${filename}"
|
||||
|
||||
tempfile="$(mktemp)"
|
||||
curl \
|
||||
--location \
|
||||
--output "${outfile}" \
|
||||
--output "${tempfile}" \
|
||||
--silent \
|
||||
"${picture_url}"
|
||||
mv "${tempfile}" "${outfile}"
|
||||
ln \
|
||||
--force \
|
||||
--symbolic \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue