Skip to content

Commit a110f6e

Browse files
authored
Merge pull request #4 from pve/master
Add get functionality to the container
2 parents 7eef936 + 451cead commit a110f6e

File tree

5 files changed

+27
-1
lines changed

5 files changed

+27
-1
lines changed

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@ RUN chmod +x /start.sh
1515
ADD sync.sh /sync.sh
1616
RUN chmod +x /sync.sh
1717

18+
ADD get.sh /get.sh
19+
RUN chmod +x /get.sh
20+
1821
ENTRYPOINT ["/start.sh"]
1922
CMD [""]

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,21 @@ Run once then delete the container:
4242
-v /home/user/data:/data:ro \
4343
istepanov/backup-to-s3 no-cron
4444

45+
Run once to get from S3 then delete the container:
46+
47+
docker run --rm \
48+
-e ACCESS_KEY=myawskey \
49+
-e SECRET_KEY=myawssecret \
50+
-e S3_PATH=s3://my-bucket/backup/ \
51+
-v /home/user/data:/data:rw \
52+
istepanov/backup-to-s3 get
53+
4554
Run once to delete from s3 then delete the container:
4655

4756
docker run --rm \
4857
-e ACCESS_KEY=myawskey \
4958
-e SECRET_KEY=myawssecret \
5059
-e S3_PATH=s3://my-bucket/backup/ \
5160
istepanov/backup-to-s3 delete
61+
62+
Security considerations: on restore, this opens up permissions on the restored files widely.

get.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo "Job get started: $(date)"
6+
7+
umask 0
8+
/usr/local/bin/s3cmd get -r $PARAMS "$S3_PATH" "$DATA_PATH"
9+
10+
echo "Job get finished: $(date)"

s3cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ log_target_prefix =
2424
mime_type =
2525
multipart_chunk_size_mb = 15
2626
preserve_attrs = True
27-
progress_meter = True
27+
progress_meter = False
2828
proxy_host =
2929
proxy_port = 0
3030
recursive = False

start.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ echo "secret_key=$SECRET_KEY" >> /root/.s3cfg
1313

1414
if [[ "$1" == 'no-cron' ]]; then
1515
exec /sync.sh
16+
elif [[ "$1" == 'get' ]]; then
17+
exec /get.sh
1618
elif [[ "$1" == 'delete' ]]; then
1719
exec /usr/local/bin/s3cmd del -r "$S3_PATH"
1820
else

0 commit comments

Comments
 (0)