Linux 服务器运行 systemd 服务报错 neither $XDG_CONFIG_HOME nor $HOME are defined
/etc/systemd/system/yarr.service
[Unit]
Description = yarr rss reader
[Service]
Type = simple
ExecStart = /root/proj/yarr/yarr
[Install]
在该服务的 systemd 单元文件中定义这些环境变量,以解决相关的配置问题。
[Unit]
Description = yarr rss reader
[Service]
Type = simple
ExecStart = /root/proj/yarr/yarr
Environment=HOME=/root
Environment=XDG_CONFIG_HOME=/root/.config
[Install]
使用以下命令重新加载 systemd 并启动或重新启动服务:
systemctl daemon-reload
systemctl start yarr.service