عرض عملي: تشغيل Shop كخدمة systemd
في هذا الدرس 3 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
run the Shop JAR as a managed service. Prepares JNR-048-LAB1.
تفاصيل المخطط المبدئي
خطوة بخطوة
- Create a
shopsystem user and copy the JAR to/opt/shop. - Write
/etc/systemd/system/shop.servicewithUser=shop,ExecStart=java -jar /opt/shop/shop.jar,Restart=on-failure. systemctl daemon-reload,enable --now shop, then checkstatusandjournalctl -u shop.- Find the port with
ss -tlnpand call the health endpoint withcurl. - Planned mistake: the JAR is owned by root with mode 600, so the service fails with "permission denied"; fix with
chownandchmod 640, not777. killthe process and show systemd restarting it.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.