fix: Use service name instead of container name in restart script
- Changed docker compose restart to use 'trading-bot' service name - Fixed 'no such service' error - Tested and verified restart functionality works
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
|
||||
WATCH_DIR="/home/icke/traderv4/logs"
|
||||
RESTART_FLAG="$WATCH_DIR/.restart-requested"
|
||||
CONTAINER_NAME="trading-bot-v4"
|
||||
SERVICE_NAME="trading-bot"
|
||||
|
||||
echo "🔍 Watching for restart requests in: $WATCH_DIR"
|
||||
echo "📦 Container: $CONTAINER_NAME"
|
||||
echo "📦 Service: $SERVICE_NAME"
|
||||
echo ""
|
||||
|
||||
# Create logs directory if it doesn't exist
|
||||
@@ -18,19 +18,19 @@ mkdir -p "$WATCH_DIR"
|
||||
while true; do
|
||||
if [ -f "$RESTART_FLAG" ]; then
|
||||
echo "🔄 Restart requested at $(cat $RESTART_FLAG)"
|
||||
echo "🔄 Restarting container: $CONTAINER_NAME"
|
||||
echo "🔄 Restarting service: $SERVICE_NAME"
|
||||
|
||||
# Remove flag before restart
|
||||
rm "$RESTART_FLAG"
|
||||
|
||||
# Restart container
|
||||
# Restart service using docker compose
|
||||
cd /home/icke/traderv4
|
||||
docker compose restart $CONTAINER_NAME
|
||||
docker compose restart $SERVICE_NAME
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Container restarted successfully"
|
||||
echo "✅ Service restarted successfully"
|
||||
else
|
||||
echo "❌ Failed to restart container"
|
||||
echo "❌ Failed to restart service"
|
||||
fi
|
||||
echo ""
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user