gateway
إدارة خدمة Gateway: البدء، الإيقاف، إعادة التشغيل، والتحقق من الحالة.
ما هو Gateway؟
Gateway هو خدمة daemon طويلة العمر تدير الوكلاء، القنوات، والأدوات. إنه القلب النابض لـ OpenClaw ويجب أن يعمل لاستخدام القنوات والمهام المجدولة.
الأوامر الأساسية
بدء Gateway
openclaw gateway start openclaw gateway start --port 18789 openclaw gateway start --background
إيقاف Gateway
openclaw gateway stop openclaw gateway stop --force
إعادة تشغيل Gateway
openclaw gateway restart
التحقق من الحالة
openclaw gateway status openclaw gateway health
الخيارات
--port- منفذ Gateway (الافتراضي: 18789)--background- تشغيل في الخلفية (daemon)--foreground- تشغيل في المقدمة (للتطوير)--log-level- مستوى السجلات (debug، info، warn، error)--force- إيقاف إجباري (قتل العملية)
السجلات
عرض سجلات Gateway:
openclaw gateway logs openclaw gateway logs --follow openclaw gateway logs --tail 100
التكوين
إعدادات Gateway في ~/.openclaw/openclaw.json:
{
"gateway": {
"enabled": true,
"port": 18789,
"host": "127.0.0.1",
"logLevel": "info",
"cors": {
"enabled": false,
"origins": []
}
}
}أمان:
افتراضيًا، يربط Gateway على 127.0.0.1 (localhost فقط). للوصول البعيد، استخدم نفق SSH أو Tailscale بدلاً من تعريض Gateway مباشرة للإنترنت.
التشغيل التلقائي
macOS (launchd)
openclaw gateway install # أو يدويًا: cp ~/.openclaw/launchd.plist ~/Library/LaunchAgents/ai.openclaw.gateway.plist launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist
Linux (systemd)
openclaw gateway install # أو يدويًا: cp ~/.openclaw/gateway.service ~/.config/systemd/user/ systemctl --user enable openclaw-gateway systemctl --user start openclaw-gateway
استكشاف الأخطاء
Gateway لا يبدأ
- تحقق من أن المنفذ غير مستخدم:
lsof -i :18789 - تحقق من السجلات:
openclaw gateway logs - تحقق من التكوين:
openclaw doctor
Gateway يتوقف بشكل غير متوقع
- افحص السجلات للأخطاء
- تحقق من الذاكرة والموارد المتاحة
- جرب إعادة التشغيل:
openclaw gateway restart
لا يمكن الاتصال بـ Gateway
- تحقق من أن Gateway يعمل:
openclaw gateway status - تحقق من المنفذ:
curl http://localhost:18789/health - تحقق من جدار الحماية