todo marker + log is path independend

This commit is contained in:
6543 2019-09-04 15:38:47 +02:00
parent 5e16e006e6
commit 74217e16bf
Signed by: 6543
GPG Key ID: A1CA74D27FD13271
1 changed files with 6 additions and 6 deletions

12
cp_sh
View File

@ -19,8 +19,8 @@ cat "$md5_tmp" | while read line; do
file_orig="$(echo $line | cut -c 33- | sed -r -e "s/^[\ ]//g")"
file_size=$(du "$file_orig" | cut -f 1)
file_md5=$(echo $line | cut -c -32)
file_aim_dir=$(echo $file_orig | rev | cut -d '/' -f 2- | rev | sed 's/data\/Filme/mnt\/export\/transport/g')
file_aim=$(echo $file_orig | sed 's/data\/Filme/mnt\/export\/transport/g')
file_aim_dir=$(echo $file_orig | rev | cut -d '/' -f 2- | rev | sed 's/data\/Filme/mnt\/export\/transport/g') #prepare destination - not automated jet
file_aim=$(echo $file_orig | sed 's/data\/Filme/mnt\/export\/transport/g') #prepare destination - not automated jet

[ "$file_orig" == "$file_aim" ] && { echo Script ERROR; exit 255; }

@ -38,19 +38,19 @@ cat "$md5_tmp" | while read line; do
file_md5_new=$(cat "$file_orig" | tee "$file_aim" | md5sum | cut -c -32)

if [ "${file_md5_new}" == "${file_md5}" ]; then
echo "$file_md5 $file_aim" >> /mnt/export/md5.txt
echo "$file_md5 $file_aim" >> "${md5}.sucess-log"
sed -i "/$file_md5/d" "$md5"
else
echo "Error: Hash mismatch: \"NEW:${file_md5_new} OLD:${file_md5}\" $file_aim"
echo "Error: Hash mismatch: \"NEW:${file_md5_new} OLD:${file_md5}\" $file_aim" | tee "${md5}.error-log"
sed -i "/$file_md5/d" "$md5"
fi

else
echo "To Big: $file_md5 $file_orig"
echo "To Big: $file_md5 $file_orig" | tee "${md5}.error-log"
fi

else
echo "Error: Not Exist: $file_orig"
echo "Error: Not Exist: $file_orig" | tee "${md5}.error-log"
sed -i "/$file_md5/d" "$md5"
fi
done