Demo: running Shop as a systemd service
On This Lesson 3 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
run the Shop JAR as a managed service. Prepares JNR-048-LAB1.
Draft outline details
Step by step
- 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.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.