Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bobarr.sh to check if 'docker-compose' or 'docker compose' is present on the system. #276

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions scripts/bobarr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,50 @@ cat << "EOF"

EOF

if docker compose > /dev/null 2>&1; then
if docker compose version --short | grep "^2." > /dev/null 2>&1; then
COMPOSE_VERSION='docker compose'
fi
elif docker-compose > /dev/null 2>&1; then
if ! [[ $(alias docker-compose 2> /dev/null) ]] ; then
if docker-compose version --short | grep "^2." > /dev/null 2>&1; then
COMPOSE_VERSION='docker-compose'
fi
fi
fi

args=$1

stop_bobarr() {
docker-compose down --remove-orphans || true
$COMPOSE_VERSION down --remove-orphans || true
}

after_start() {
echo ""
echo "bobarr started correctly, printing bobarr api logs"
echo "you can close this and bobarr will continue to run in backgound"
echo ""
docker-compose logs -f api
$COMPOSE_VERSION logs -f api
}

if [[ $args == 'start' ]]; then
stop_bobarr
docker-compose up --force-recreate -d
$COMPOSE_VERSION up --force-recreate -d
after_start
elif [[ $args == 'start:vpn' ]]; then
stop_bobarr
docker-compose -f docker-compose.yml -f docker-compose.vpn.yml up --force-recreate -d
$COMPOSE_VERSION -f docker-compose.yml -f docker-compose.vpn.yml up --force-recreate -d
after_start
elif [[ $args == 'start:wireguard' ]]; then
stop_bobarr
docker-compose -f docker-compose.yml -f docker-compose.wireguard.yml up --force-recreate -d
$COMPOSE_VERSION -f docker-compose.yml -f docker-compose.wireguard.yml up --force-recreate -d
after_start
elif [[ $args == 'stop' ]]; then
stop_bobarr
echo ""
echo "bobarr correctly stopped"
elif [[ $args == 'update' ]]; then
docker-compose pull
$COMPOSE_VERSION pull
echo ""
echo "bobarr docker images correctly updated, you can now re-start bobarr"
else
Expand Down
Loading