Created
September 21, 2024 22:34
-
-
Save foursixnine/91a472bab7728dd8b80be0828de052f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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