Skip to content

Commit

Permalink
add maintenance script for removing orphaned swift segments after rcl…
Browse files Browse the repository at this point in the history
…one bug
  • Loading branch information
stebo85 committed Sep 17, 2024
1 parent ffe7e11 commit b53a2f4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions maintenance/cleanup_orphaned_segments_nectar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This cleanup was necessary because rclone in version 1.54 wasn't deleting the segments correctly. The latest version of rclone fixes this problem and this is how we cleanup up the orphaned segments:

source ~/swift_setup.sh
swift list neurodesk_segments > neurodesk_segments.txt
swift list neurodesk > legitimate_objects.txt

# check if the object is in the legitimate_objects.txt
while IFS= read -r line
do
name=$(echo $line | cut -d'/' -f1)
# echo "looking for $name"
if grep -q "$name" legitimate_objects.txt; then
# echo "$line is a legitimate object"
continue
else
echo "$line is an orphaned object"
# swift delete neurodesk_segments $line
fi
done < neurodesk_segments.txt

0 comments on commit b53a2f4

Please sign in to comment.