systemd 最佳实践,项目结构

systemd 最佳实践,项目结构

假设我有几个驱动程序、一些使用这些驱动程序的 C++ 应用程序,以及几个与 C++ 应用程序交互的 Java 应用程序。到目前为止我收集到的...

drivers.target

[Unit]
Description=Drivers Target
# No contents, just a target for driver services to "register" with

驱动程序-apps.target

[Unit]
Description=Driver-dependent Applications Target
Wants=drivers.target
After=drivers.target

项目应用程序.target

[Unit]
Description(non-driver-dependent) Applications Target
Wants=drivers-apps.target
After=drivers-apps.target

我的司机服务

[Unit]
Description=My Driver
[Service]
Type=oneshot
... # Script that starts driver, with a 'stop' script as well
RemainAfterExit=yes
[Install]
WantedBy=drivers.target

cpp-app.service

[Unit]
Description=C++ Application
ReloadPropagatedFrom=driver-apps.target
PartOf=driver-apps.target
[Service]
...
[Install]
WantedBy=driver-apps.target

cpp-app.service

[Unit]
Description=C++ Application
ReloadPropagatedFrom=driver-apps.target
PartOf=driver-apps.target
[Service]
...
[Install]
WantedBy=driver-apps.target

java-app.service

[Unit]
Description=C++ Application
ReloadPropagatedFrom=driver-apps.target
PartOf=driver-apps.target
[Service]
...
[Install]
WantedBy=project-apps.target
WantedBy=multi-user.target

我发现我必须将某些东西与 multit-user.target 或类似的高级目标联系起来。这是在启动时让一切顺利进行的正确结构吗?

相关内容