将 systemd 输出通过管道传输到文件中

Piping systemd output into a file

我正在尝试使用 >> 将 systemd 命令的输出通过管道传输到文件 就像 this 问题

不幸的是,我得到的结果表明我 运行ning 的原始命令正在使用 >> 作为开关并且无法识别它。

我之前使用 upstart 做了同样的事情,但没有 运行 进入这个错误:(

这是我的 systemd.service 文件:

[Unit]
Description=ss13_server
[Service]
User=ss13
WorkingDirectory=/home/ss13/ss13
ExecStart=/usr/local/byond/bin/DreamDaemon /home/ss13/ss13/baystation12.dmb 25565 -trusted >> /home/ss13/ss13-log
Restart=on-failure
RestartSec=90s

我得到的结果是:

Dream Daemon: invalid option '>>'

通常我会假设 DreamDaemon 有一些与 >> 不兼容的东西,但正如我所说,我过去曾成功地使用过这种方法;如果我手动 运行 命令,它也会起作用。

感谢您提供的任何帮助。

将命令行放入文件中:

#!/bin/bash
/usr/local/byond/bin/DreamDaemon /home/ss13/ss13/baystation12.dmb 25565 -trusted >> /home/ss13/ss13-log

然后让 ExecStart= 引用该文件。