backup system only saves file when hashes do not match
This commit is contained in:
parent
aeaa24562b
commit
690c23ecef
1 changed files with 9 additions and 1 deletions
|
|
@ -1,5 +1,13 @@
|
||||||
#!/run/current-system/sw/bin/zsh
|
#!/run/current-system/sw/bin/zsh
|
||||||
|
|
||||||
cd /home/horseman
|
cd /home/horseman
|
||||||
|
file=backups/$(date +%Y-%m-%d).tar
|
||||||
|
tar -cf $file Documents
|
||||||
|
|
||||||
tar -cf backups/$(date +%Y-%m-%d).tar Documents
|
if grep -q $(sha256sum $file) backups/sum; then
|
||||||
|
echo 'hashes match, quitting'
|
||||||
|
rm $file
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $(sha256sum ) > backups/sum
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue