Skip to content

Instantly share code, notes, and snippets.

@foursixnine
Created September 21, 2024 22:34
Show Gist options
  • Save foursixnine/91a472bab7728dd8b80be0828de052f2 to your computer and use it in GitHub Desktop.
Save foursixnine/91a472bab7728dd8b80be0828de052f2 to your computer and use it in GitHub Desktop.
GS_BUCKET=$1
GLACIER_STORAGE_DIR=venapp-storage
# systemd-inhibit --what=sleep --what=shutdown --who="Downloader" --mode=block --why="because yes" waitpid -v $(pgrep -f "bash -x downloader.sh") #pgrep -f "bash downloader.sh"
cd $HOME
tmux new -A -d -s gdownloader
tmux neww -t gdownloader: -n "monitor" htop
FOLDERS=$(gsutil ls ${GS_BUCKET} | cut -d\/ -f4 | grep -v -E "\.(png|jpg)" | sort -r)
echo $FOLDERS;
for f in $FOLDERS; do
echo "Processing: $f" >> downloaded.list
mkdir ./glacier/${GLACIER_STORAGE_DIR}/$f || echo "$f already exists"
tmux neww -t gdownloader: -n $f "(gsutil -m rsync -i -C -R ${GS_BUCKET}/$f ./glacier/${GLACIER_STORAGE_DIR}/$f/ |& tee $f-grsync.log && tmux wait -S ${f}gsutils || echo \"something failed with $f\"i); tmux wait ${f}gsutils; echo \"Completed: $f\" >> downloaded.list "
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment