Add systemd service file

This commit is contained in:
Mario Fetka
2026-04-21 17:57:18 +02:00
parent 0e69a47827
commit a4dd6abc12
2 changed files with 34 additions and 1 deletions

View File

@@ -30,6 +30,13 @@ configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/static/start.html"
IMMEDIATE @ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/mars-nwe-webui.service.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/mars-nwe-webui.service"
@ONLY
)
#################################
# Compiler Switches
##############
@@ -79,8 +86,11 @@ install(FILES static/smart_icon.jpg DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECD
install(FILES static/smart.jpg DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR}/static)
install(FILES static/favicon.ico DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR}/static)
if(WITH_SYSTEMD)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mars-nwe-webui.service DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR})
endif()
install(TARGETS check_login DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
install(TARGETS nwwebui DESTINATION ${CMAKE_INSTALL_SBINDIR})

View File

@@ -0,0 +1,23 @@
[Unit]
Description=MARS NWE Web UI
After=network.target mars-nwe-serv.service
Wants=network.target
Documentation=man:systemd.service(5)
[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/
ExecStart=@CMAKE_INSTALL_FULL_SBINDIR@/nwwebui -c @MARS_NWE_INSTALL_FULL_CONFDIR@/smart.conf
Restart=on-failure
RestartSec=2
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectHome=true
[Install]
WantedBy=multi-user.target