ExecStartPre=/usr/bin/mkfifo /dev/fifofile || /bin/true
That's fine as a shell command line, but systemd doesn't run
ExecStartPre commands and such through the shell. (I'm not sure if the paths of
true are be needed)
The documentation says that:
Each command line is unquoted using the rules described in "Quoting" section in systemd.syntax(5). The first item becomes the command to execute, and the subsequent items the arguments.
This syntax is inspired by shell syntax, but only the meta-characters and expansions described in the following paragraphs are understood, and the expansion of variables is different. Specifically, redirection using "<", "<<", ">", and ">>", pipes using "|", running programs in the background using "&", and other elements of shell syntax are not supported.
But as quotes should work, you could be able to explicitly run a shell with something like
ExecStartPre=sh -c 'mkfifo /dev/fifofile || true'.
That should not be necessary, however, since systemd has a special syntax for ignoring errors.
If the executable path is prefixed with "-", an exit code of the command normally considered a failure (i.e. non-zero exit status or abnormal exit due to signal) is recorded, but has no further effect and is considered equivalent to success.
I'm not sure about the inevitable error message, though, as the note about redirections only mentions
>, and not
2>. But you could also do this to remove the file first and then recreate it:
ExecStartPre=-rm -f /dev/fifofile
Or maybe something like
ExecStartPre=-rm -f /dev/fifofile ; mkfifo /dev/fifofile
but I didn't test. Also that would of course nuke any other file with the same name.
If you want to guard against that, you could do something like this:
ExecStartPre=sh -c '[ -p /dev/fifofile ] || mkfifo /dev/fifofile'
That should quit silently if the pipe already exists, but would let
mkfifo give an error if the file exists and isn't already a pipe.
There might also be a more "correct" place to put the fifo file.