Systemd:修订间差异
跳到导航
跳到搜索
此页面具有访问限制。如果您看见此消息,则说明您没有权限访问此页面。
(→首段) |
(→設定) |
||
第4行: | 第4行: | ||
== 設定 == | == 設定 == | ||
system模式下不需要額外設定就可以用,建議將自製的service檔案裝到<code>/etc/systemd/system</code>下;user模式下需要針對特定使用者啟 | system模式下不需要額外設定就可以用,建議將自製的service檔案裝到<code>/etc/systemd/system</code>下;user模式下需要針對特定使用者啟 動user自己的systemd : | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> |
2023年10月7日 (六) 05:09的版本
systemd是一个系统套件。
设定
system模式下不需要额外设定就可以用,建议将自制的service档案装到/etc/systemd/system
下;user模式下需要针对特定使用者启动user自己的systemd:
sudo loginctl enable-linger foo
另外在.profile
内可能会需要指定XDG_RUNTIME_DIR
:
export XDG_RUNTIME_DIR=/run/user/$(id -u)
范例
这是一个很简单的范例,放在/etc/systemd/system/
下:
#
[Unit]
Description=Description
After=remote-fs.target
[Service]
ExecStart=/usr/bin/spawn-fcgi
Restart=on-failure
RestartSec=60
Type=simple
[Install]
WantedBy=multi-user.target
这是user模式下的(因为user模式下没有multi-user.target
,也不需要remote-fs.target
),放在~/.config/systemd/user/
下:
#
[Unit]
Description=Description
[Service]
ExecStart=/usr/bin/spawn-fcgi
Restart=on-failure
RestartSec=60
Type=simple
[Install]
WantedBy=default.target
外部链接
- 官方网站 (英文)