The documentation states that you can set StandardOutput=
and StandardError=
to whatever you want. They default to the journal, but you can redirect them to any of several places.
Controls where file descriptor 1 (STDOUT) of the executed processes is connected to. Takes one of inherit
, null
, tty
, journal
, syslog
, kmsg
, journal+console
, syslog+console
, kmsg+console
, file:path
, append:path
, truncate:path
, socket
or fd
.
...
null
connects standard output to /dev/null
, i.e. everything written to it will be lost.
StandardError=
is similar, with an important exception to how it inherit
s (which is also the default):
Controls where file descriptor 2 (STDERR) of the executed processes is connected to. The available options are identical to those of StandardOutput=
, with some exceptions: if set to inherit
the file descriptor used for standard output is duplicated for standard error, while fd
operates on the error stream and will look by default for a descriptor named "stderr"
.
So, you can do this:
[Service]
StandardOutput=null
StandardError=journal
But keep in mind that you will lose the output from the script; more importantly, if there is a problem and the script outputs an error on standard output instead of standard error (as many shell scripts do), you will lose that as well. When something goes wrong, this will cause you a whole lot of unnecessary frustration.
So, you really should do nothing to the systemd unit. Rather, if you don't want the script to output anything on success, fix the script.