====== Runbook: Start/Stop Server ======
**Duration:** ~5 minutes \\
**Role:** Gateway Operator \\
**Prerequisite:** Administrator rights
----
===== Workflow =====
flowchart TD
A[Start] --> B{Already running?}
B -->|Yes| C[Stop]
B -->|No| D[Start]
C --> D
D --> E[Health Check]
E --> F{Successful?}
F -->|Yes| G[Done]
F -->|No| H[Check logs]
H --> D
style G fill:#e8f5e9
style H fill:#ffebee
----
===== 1. Check Status =====
**Windows:**
# Find process
Get-Process -Name "WvdS.WebAPI.Data.Gateway.Api" -ErrorAction SilentlyContinue
# Or via port
netstat -ano | findstr :5000
**Linux:**
# Find process
pgrep -f "WvdS.WebAPI.Data.Gateway.Api"
# Or via port
ss -tlnp | grep 5000
----
===== 2. Start Server =====
**Windows (Console):**
cd %GATEWAY_ROOT%
.\WvdS.WebAPI.Data.Gateway.Api.exe
**Windows (Background):**
Start-Process -FilePath "%GATEWAY_ROOT%\WvdS.WebAPI.Data.Gateway.Api.exe" -WindowStyle Hidden
**Linux:**
cd /opt/gateway
./WvdS.WebAPI.Data.Gateway.Api &
----
===== 3. Stop Server =====
**Windows:**
# Graceful shutdown
Stop-Process -Name "WvdS.WebAPI.Data.Gateway.Api" -Force
**Linux:**
# Graceful shutdown
pkill -SIGTERM -f "WvdS.WebAPI.Data.Gateway.Api"
# Force kill (only if necessary)
pkill -9 -f "WvdS.WebAPI.Data.Gateway.Api"
----
===== 4. Health Check =====
# Check availability
curl -s http://localhost:5000/health
# Expected response: "Healthy"
----
===== 5. Checklist =====
| # | Check | Done |
|---|-------|------|
| 1 | Process running | [ ] |
| 2 | Port 5000 open | [ ] |
| 3 | Health Check "Healthy" | [ ] |
| 4 | No errors in console | [ ] |
----
===== Troubleshooting =====
| Problem | Cause | Solution |
|---------|-------|----------|
| ''Port already in use'' | Old process running | Stop process, then start |
| ''Access denied'' | Missing permissions | Start as administrator |
| ''Config error'' | appsettings.json faulty | Check JSON syntax |
| ''Database connection failed'' | DSN misconfigured | Check connection string |
----
===== Related Runbooks =====
* [[.:health-check|Health Check]] - Detailed status check
* [[.:logs-pruefen|Check Logs]] - Error analysis
* [[..:automatisierung:windows-dienst|Windows Service]] - Run as service
----
<< [[.:start|<- Daily Operations]] | [[.:dsn-verwalten|-> Manage DSN]] >>
----
//Wolfgang van der Stille @ EMSR DATA d.o.o. - Data Gateway Professional//
{{tag>operator runbook server start stop}}