1

I am attempting to pipe the output of my command in systemd to a file using >> like in this question

Unfortunately the result I get back makes it out as if the original command i'm running is using >> as a switch and doesn't recognise it.

I did the same thing using upstart previously but did not run into this error :(

This is my systemd.service file:

[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

The result I get is:

Dream Daemon: invalid option '>>'

Normally I'd assume there's something about DreamDaemon that is incompatible with >> but as I said I have used this method successfully in the past; it will also work If I run the command manually.

Thanks for any help you can provide.

Community
  • 1
  • 1
Baa
  • 438
  • 3
  • 7
  • 22
  • In the future, `systemd` questions are better suited for [unix.stackexchange.com](http://unix.stackexchange.com), as StackOverflow is focused on programming questions. – Mark Stosberg Jul 06 '16 at 18:52
  • That doesn't work, because `>>` is a shell script option. Systemd runs the command directly without any shell. But you can of course do something like `ExecStart=bash "/mycommand >>myfile"`. – Marki555 Jul 14 '16 at 14:24
  • @Marki555: we need absolute paths, so it should be `ExecStart=/bin/bash -c ""` – Christian Severin Sep 12 '17 at 13:50

1 Answers1

0

Put your command line in a file:

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

Then have ExecStart= reference that file.

Mark Stosberg
  • 12,961
  • 6
  • 44
  • 49