Added a new configuration option, BACKUP_INTERVAL

This commit is contained in:
Fábio D. Batista 2015-09-10 16:46:45 -03:00
parent 1a27402970
commit ade7679b1e
2 changed files with 23 additions and 21 deletions

View File

@ -1,13 +1,16 @@
docker-s3-volume
==============
# docker-s3-volume
Creates a Docker container that is restored and backed up to a directory on s3. You could use this to run short lived processes that work with and persist data to and from S3.
Creates a Docker container that is restored and backed up to a directory on s3.
You could use this to run short lived processes that work with and persist data to and from S3.
Usage:
```
docker run -it --rm \
-e ACCESS_KEY=... -e SECRET_KEY=... whatupdave/s3-volume s3://<BUCKET>/<PATH>
```
-e AWS_ACCESS_KEY_ID=... -e AWS_SECRET_ACCESS_KEY=... -e BACKUP_INTERVAL=... \
whatupdave/s3-volume s3://<BUCKET>/<PATH>
This pulls down the contents of a directory on S3. If the container is stopped or sent a `USR1` signal, it will backup the modified local contents to S3.
This pulls down the contents of a directory on S3. If the container is stopped or sent a `USR1` signal,
it will backup the modified local contents to S3.
If you supply a `BACKUP_INTERVAL` environment variable, a backup will be issued each interval. The value can
be specified in seconds, minutes, hours or days (adding `s`, `m`, `h` or `d` as suffix).

9
watch
View File

@ -19,14 +19,12 @@ function error_exit {
}
PARSED_OPTIONS=$(getopt -n "$0" -o f --long "force-restore" -- "$@")
if [ $? -ne 0 ];
then
if [ $? -ne 0 ]; then
exit 1
fi
eval set -- "$PARSED_OPTIONS"
while true;
do
while true; do
case "$1" in
-f|--force-restore)
FORCE_RESTORE="true"
@ -75,8 +73,9 @@ function final_backup {
function idle {
echo "ready"
while true; do
sleep 42 &
sleep ${BACKUP_INTERVAL:-42} &
wait $!
[ -n "$BACKUP_INTERVAL" ] && backup
done
}