Guest User

Untitled

a guest
Feb 6th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #!/bin/bash
  2. # This file is controlled by Chef. Manual changes will be overwritten.
  3. # Script to upload ddex files to GCS bucket.
  4. set -e
  5. LOGFILE=/var/log/inotify.log
  6. ROOT_DIR="$1"
  7. UPLOADED_FILE="$2"
  8. BUCKETNAME=test
  9. UPLOAD_PATH=$(dirname $(realpath --relative-to="$ROOT_DIR" "$UPLOADED_FILE"))
  10. gsutil mv "$UPLOADED_FILE" "gs://$BUCKETNAME/$UPLOAD_PATH/" >> $LOGFILE 2>&1
  11. if [[ $? -eq 0 ]]
  12. then
  13. find $ROOT_DIR -mindepth 2 -depth -type d -print0 -exec rmdir {} \; >> $LOGFILE 2>&1
  14. else
  15. echo "Cannot delete $UPLOAD_PATH directory as upload was not successful."
  16. exit
  17. fi
Add Comment
Please, Sign In to add comment