forked from FDA/open.fda.gov
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush-site.sh
More file actions
executable file
·31 lines (18 loc) · 807 Bytes
/
Copy pathpush-site.sh
File metadata and controls
executable file
·31 lines (18 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
TODAY=$(date +"%Y-%m-%d")
BUCKET="open.fda.gov-$TODAY"
echo "Pushing to: ${BUCKET}"
read -p "Do you want to continue (y/n)? "
[ "$(echo $REPLY | tr [:upper:] [:lower:])" == "y" ] || exit
set -x
aws --profile openfda s3 mb s3://${BUCKET} --region us-east-1
aws --profile openfda s3 website s3://${BUCKET} --index-document index.html --error-document error.html
cd public
echo "Dry run..."
aws --profile openfda s3 sync . s3://${BUCKET} --acl public-read --cache-control max-age=300 --dryrun
read -p "Do you want to continue (y/n)? "
[ "$(echo $REPLY | tr [:upper:] [:lower:])" == "y" ] || exit
echo "Pushing..."
aws --profile openfda s3 sync . s3://${BUCKET} --acl public-read --cache-control max-age=300
echo "Loading..."
open "http://${BUCKET}.s3-website-us-east-1.amazonaws.com/"