fixed backup script to use full path to docker-compose for use in cron jobs
This commit is contained in:
parent
528b0ee77f
commit
c51cd684e2
BIN
backup.tar.gz
Normal file
BIN
backup.tar.gz
Normal file
Binary file not shown.
|
@ -2,15 +2,17 @@
|
|||
|
||||
[ $# -lt 2 ] && { echo "Usage: $0 {backup|restore} BACKUP_FILENAME"; exit 1; }
|
||||
|
||||
DOCKER_COMPOSE=/usr/bin/docker-compose
|
||||
|
||||
backup_file=$2
|
||||
|
||||
project_subscriber_volume_name=client_data
|
||||
project_tor_volume_name=tor_config
|
||||
tor_service=tor
|
||||
|
||||
docker-compose --log-level WARNING up --no-start
|
||||
$DOCKER_COMPOSE --log-level WARNING up --no-start
|
||||
|
||||
project_name=$(docker ps -a --no-trunc | grep $(docker-compose ps -q ${tor_service}) | awk '{ print $2; }' | awk -F "_" '{ print $1; }')
|
||||
project_name=$(docker ps -a --no-trunc | grep $($DOCKER_COMPOSE ps -q ${tor_service}) | awk '{ print $2; }' | awk -F "_" '{ print $1; }')
|
||||
|
||||
project_volumes=$(docker volume ls -f name=$project_name | awk '{if (NR > 1) print $2"\n";}')
|
||||
|
||||
|
@ -34,7 +36,7 @@ function backup {
|
|||
|
||||
function restore {
|
||||
|
||||
docker-compose stop $tor_service
|
||||
$DOCKER_COMPOSE stop $tor_service
|
||||
|
||||
docker run --rm \
|
||||
-v $subscriber_volume:/data/subscriber \
|
||||
|
@ -43,7 +45,7 @@ function restore {
|
|||
ubuntu \
|
||||
tar -C / -xzvf /backup/backup.tar.gz
|
||||
|
||||
docker-compose start $tor_service
|
||||
$DOCKER_COMPOSE start $tor_service
|
||||
}
|
||||
|
||||
$1
|
Loading…
Reference in New Issue
Block a user