-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstop.sh
More file actions
58 lines (50 loc) · 1.5 KB
/
stop.sh
File metadata and controls
58 lines (50 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
set -euo pipefail
# ============================================================
# DaveFelix Coding Engine — Stop Services
# ============================================================
# Usage:
# bash stop.sh # Stop all containers
# bash stop.sh --clean # Stop + remove volumes (fresh start)
# ============================================================
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m'
info() { echo -e "${CYAN}[INFO]${NC} $*"; }
ok() { echo -e "${GREEN}[OK]${NC} $*"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
# Detect compose command
if docker compose version >/dev/null 2>&1; then
COMPOSE="docker compose"
elif command -v docker-compose >/dev/null 2>&1; then
COMPOSE="docker-compose"
else
echo "Docker Compose not found."
exit 1
fi
CLEAN=false
for arg in "$@"; do
case "$arg" in
--clean) CLEAN=true ;;
--help|-h)
echo "Usage: bash stop.sh [--clean]"
echo " --clean Also remove Docker volumes (database, redis, etc.)"
exit 0
;;
esac
done
echo ""
info "Stopping all Coding Engine services..."
if [ "$CLEAN" = true ]; then
warn "Removing containers AND volumes (--clean)"
$COMPOSE down -v --remove-orphans 2>/dev/null
ok "All containers and volumes removed"
else
$COMPOSE down --remove-orphans 2>/dev/null
ok "All containers stopped (volumes preserved)"
fi
echo ""
echo " Restart with: bash start.sh"
echo ""