mirror of
https://github.com/getumbrel/umbrel.git
synced 2026-10-12 02:14:08 +00:00
67 lines
1.7 KiB
Bash
Executable File
67 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Stop Umbrel
|
|
|
|
if [[ $UID != 0 ]]; then
|
|
echo "Umbrel must be stopped as root"
|
|
echo "Please re-run this script as"
|
|
echo " sudo ./scripts/stop"
|
|
exit 1
|
|
fi
|
|
|
|
UMBREL_ROOT="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))/.."
|
|
USER_FILE="${UMBREL_ROOT}/db/user.json"
|
|
|
|
REMOTE_TOR_ACCESS="false"
|
|
if [[ -f "${USER_FILE}" ]]; then
|
|
REMOTE_TOR_ACCESS=$(cat "${USER_FILE}" | jq 'has("remoteTorAccess") and .remoteTorAccess')
|
|
fi
|
|
|
|
if [[ ! -d "$UMBREL_ROOT" ]]; then
|
|
echo "Root dir does not exist '$UMBREL_ROOT'"
|
|
exit 1
|
|
fi
|
|
|
|
cd "$UMBREL_ROOT"
|
|
|
|
# Increase default Docker and Compose timeouts to 240s
|
|
# As bitcoin can take a long while to respond
|
|
export DOCKER_CLIENT_TIMEOUT=240
|
|
export COMPOSE_HTTP_TIMEOUT=240
|
|
|
|
# TODO: Transition to pidfiles so we can reliably kill these processes
|
|
# Run this before Docker, as Docker can fail to stop cleanly
|
|
echo "Killing background services"
|
|
ps -Af \
|
|
| grep '\./karen\|\./scripts/status-monitor\|\./scripts/memory-monitor\|\./scripts/backup/\|umbrel/scripts\|fswatch' \
|
|
| grep -v '\-run.sh\|update\|stop\|umbreld' \
|
|
| awk '{print $2}' \
|
|
| xargs sudo kill 2> /dev/null || true
|
|
|
|
if [[ "${@}" != *"--no-stop-server"* ]]; then
|
|
pkill --full 'caxa.*umbreld' || true
|
|
fi
|
|
|
|
echo "Stopping installed apps..."
|
|
echo
|
|
"${UMBREL_ROOT}/scripts/app" stop installed
|
|
echo
|
|
|
|
compose_files=()
|
|
|
|
if [[ "${REMOTE_TOR_ACCESS}" == "true" ]]; then
|
|
compose_files+=( "--file" "docker-compose.tor.yml" )
|
|
fi
|
|
|
|
compose_files+=( "--file" "docker-compose.yml" )
|
|
|
|
UMBREL_DEV_FILE="${UMBREL_ROOT}/.umbrel-dev"
|
|
if [[ -f "${UMBREL_DEV_FILE}" ]]; then
|
|
compose_files+=( "--file" "${UMBREL_ROOT}/docker-compose.dev.yml" )
|
|
fi
|
|
|
|
echo "Stopping Docker services..."
|
|
echo
|
|
docker-compose "${compose_files[@]}" down
|