/llamafarm:stop - Stop LlamaFarm Services
Gracefully stop all running LlamaFarm services.
Usage
/llamafarm:stop # Stop all services
/llamafarm:stop --force # Force stop (SIGKILL)
What This Command Does
- Checks running services - Identifies what's currently running
- Graceful shutdown - Sends stop signal to services
- Waits for cleanup - Allows in-progress tasks to complete
- Confirms shutdown - Verifies services are stopped
Implementation
When the user runs /llamafarm:stop, follow these steps:
Step 1: Check Current Status
lf services status
If no services are running:
No LlamaFarm services are currently running.
Step 2: Stop Services
lf services stop
This gracefully stops:
- FastAPI server
- Celery RAG worker
- Any background tasks
Step 3: Verify Shutdown
# Check that port 8000 is freed
lsof -i :14345 || echo "PORT_FREED"
# Verify no LlamaFarm processes
pgrep -f "llamafarm" || echo "NO_PROCESSES"
Step 4: Report Results
LlamaFarm Services Stopped
==========================
All services have been stopped gracefully.
Components stopped:
- Server (port 8000)
- RAG Worker
To restart: /llamafarm:start or `lf start`
Force Stop
If services don't respond to graceful shutdown:
# Force kill all LlamaFarm processes
pkill -9 -f "llamafarm"
pkill -9 -f "celery.*llamafarm"
Report:
Services force-stopped.
Note: Force stop may leave temporary files or incomplete tasks.
Check /llamafarm:status to verify clean state.
Error Handling
Services Not Responding
If graceful stop times out:
Services not responding to graceful shutdown.
Options:
1. Wait longer: /llamafarm:stop --timeout 60
2. Force stop: /llamafarm:stop --force
3. Manual cleanup: pkill -9 -f llamafarm
Orphaned Processes
If processes remain after stop:
ps aux | grep -E "(llamafarm|celery)" | grep -v grep
Provide PIDs for manual cleanup if needed.
Related Commands
/llamafarm:start- Start services/llamafarm:status- Check service health