all tabs
This commit is contained in:
1 parent
e9175bc139
commit
e5f034b394
1 file changed
+17
-13
+17
-13
@@ -26,7 +26,7 @@ function import_files {
|
|||||||
if [[ "$file" =~ ^eidf[a-zA-Z0-9]{2,5}-[a-zA-Z0-9]{3,8}-.+$ ]] && [[ -f "$filepath" ]]; then
|
if [[ "$file" =~ ^eidf[a-zA-Z0-9]{2,5}-[a-zA-Z0-9]{3,8}-.+$ ]] && [[ -f "$filepath" ]]; then
|
||||||
echo "File '$file' is formatted correctly"
|
echo "File '$file' is formatted correctly"
|
||||||
else
|
else
|
||||||
echo "IMPORT FAILED FOR '$file'. Incorrect formatting." | tee -a $TODAY_FAILURES
|
echo "IMPORT FAILED FOR '$file'. Incorrect formatting." | tee -a $TODAY_FAILURES
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -59,9 +59,10 @@ function import_files {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Extra Check - If file has been modified in the last 3 minutes, don't move it
|
||||||
if (( $(date +%s) - $(stat -c %Y "$LANDING_DIR/$file") < (6*3) )); then
|
if (( $(date +%s) - $(stat -c %Y "$LANDING_DIR/$file") < (6*3) )); then
|
||||||
echo "File $file modified in the last 3 minutes. Waiting for upload to complete"
|
echo "File $file modified in the last 3 minutes. Waiting for upload to complete"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $project 'directory mounted at' $project_mount
|
echo $project 'directory mounted at' $project_mount
|
||||||
@@ -70,6 +71,9 @@ function import_files {
|
|||||||
read -r sha256 _ < <(/usr/bin/sha256sum "$filepath")
|
read -r sha256 _ < <(/usr/bin/sha256sum "$filepath")
|
||||||
printf '%s | %s\n' "$sha256" "$filepath" | tee -a $TODAY_INGRESS
|
printf '%s | %s\n' "$sha256" "$filepath" | tee -a $TODAY_INGRESS
|
||||||
|
|
||||||
|
# Extracts Windows/Linux from $project_mount and sets the 'environment' vairable
|
||||||
|
# This changes the moving path depending if window or Linux
|
||||||
|
|
||||||
local environment="${project_mount#/mnt/}"
|
local environment="${project_mount#/mnt/}"
|
||||||
local environment="${environment%%/*}"
|
local environment="${environment%%/*}"
|
||||||
|
|
||||||
@@ -78,11 +82,11 @@ function import_files {
|
|||||||
echo "IMPORT FAILED FOR FILE $file - Study could not be identified"
|
echo "IMPORT FAILED FOR FILE $file - Study could not be identified"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
echo "$LANDING_DIR/$file $project_mount/Import/$study"
|
echo "$LANDING_DIR/$file $project_mount/Import/$study"
|
||||||
mv $LANDING_DIR/$file $project_mount/Import/$study
|
mv $LANDING_DIR/$file $project_mount/Import/$study
|
||||||
fi
|
fi
|
||||||
elif [[ $environment == "linux" ]]; then
|
elif [[ $environment == "linux" ]]; then
|
||||||
echo "$filepath $project_mount/Import"
|
echo "$filepath $project_mount/Import"
|
||||||
mv "$filepath" $project_mount/Import
|
mv "$filepath" $project_mount/Import
|
||||||
chown root:$project "$project_mount/Import/$file"
|
chown root:$project "$project_mount/Import/$file"
|
||||||
else
|
else
|
||||||
@@ -103,9 +107,9 @@ function export_files {
|
|||||||
local project="${project%%/Export/*}"
|
local project="${project%%/Export/*}"
|
||||||
|
|
||||||
if (( $(date +%s) - $(stat -c %Y $filepath) < (60*3) )); then
|
if (( $(date +%s) - $(stat -c %Y $filepath) < (60*3) )); then
|
||||||
echo "File $file has been modified in the last 3 minutes. Waiting for write to complete"
|
echo "File $file has been modified in the last 3 minutes. Waiting for write to complete"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$file from $project will be exported"
|
echo "$file from $project will be exported"
|
||||||
|
|
||||||
@@ -117,7 +121,7 @@ function export_files {
|
|||||||
echo $new_filename
|
echo $new_filename
|
||||||
|
|
||||||
read -r sha256 _ < <(/usr/bin/sha256sum "$filepath")
|
read -r sha256 _ < <(/usr/bin/sha256sum "$filepath")
|
||||||
printf '%s | %s\n' "$sha256" "$new_filename" | tee -a $TODAY_EGRESS
|
printf '%s | %s\n' "$sha256" "$new_filename" | tee -a $TODAY_EGRESS
|
||||||
|
|
||||||
mv "$filepath" "$EXPORT_DIR/$new_filename"
|
mv "$filepath" "$EXPORT_DIR/$new_filename"
|
||||||
chgrp $project "$EXPORT_DIR/$new_filename"
|
chgrp $project "$EXPORT_DIR/$new_filename"
|
||||||
@@ -144,8 +148,8 @@ function export_files {
|
|||||||
|
|
||||||
if (( $(date +%s) - $(stat -c %Y $filepath) < (60*3) )); then
|
if (( $(date +%s) - $(stat -c %Y $filepath) < (60*3) )); then
|
||||||
echo "File $file has been modified in the last 3 minutes. Waiting for write to complete"
|
echo "File $file has been modified in the last 3 minutes. Waiting for write to complete"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$file from $project will be exported"
|
echo "$file from $project will be exported"
|
||||||
|
|
||||||
@@ -157,7 +161,7 @@ function export_files {
|
|||||||
echo "$file will be renamed $new_filename"
|
echo "$file will be renamed $new_filename"
|
||||||
|
|
||||||
read -r sha256 _ < <(/usr/bin/sha256sum "$filepath")
|
read -r sha256 _ < <(/usr/bin/sha256sum "$filepath")
|
||||||
printf '%s | %s\n' "$sha256" "$new_filename" | tee -a $TODAY_EGRESS
|
printf '%s | %s\n' "$sha256" "$new_filename" | tee -a $TODAY_EGRESS
|
||||||
|
|
||||||
if [[ "$file" == mft-* ]]; then
|
if [[ "$file" == mft-* ]]; then
|
||||||
mv "$filepath" "/mnt/os-transfer/windows-mft/$project/$study/Export/$new_filename"
|
mv "$filepath" "/mnt/os-transfer/windows-mft/$project/$study/Export/$new_filename"
|
||||||
|
|||||||
Reference in new issue
Block a user