是否可以在用户 session 下运行 systemd session ,单元文件位于子目录中且未安装在 ~/.config/systemd
中?我正在开发一个由不同服务(用 C++ 实现)组成的系统,其中一些服务相互依赖。目前,它们从 bash 脚本运行并全部写入标准输出。我希望能够从构建目录启动它们,例如
# enter build directory
cd /path/to/project/build
# start services
systemd --root ./systemd-units &
# check status of services
systemctl --root ./systemd-units status
# check log output of services
journalctl --root ./systemd-units
不幸的是,不存在这样的选项,我也找不到任何替代方案。我不想使用 docker,因为它会使调试变得不必要的困难。
有没有办法用 systemd 做我想做的事?我调查了其他系统和runit似乎能够做我想做的事,但不太可能在最终产品中使用。
最佳答案
听起来您可能想要使用 link
systemctl 的特性,因此您可以将不是搜索路径的单元链接到搜索路径中。
关于linux - 系统 session 低于用户 session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52539574/