systemd

Silent systemd ExecStartPre script exit code


I have a service file that starts sshd depending on the exit of a script. The problem is I always get this when I boot:

[ Failed ] Failed to start SSH Daemon

I am aware of this, I don't want to see this error.

When I restart I get:

Job for sshd.service failed because the control process exited with error code.
See "systemctl status sshd.service" and "journalctl -xeu sshd.service" for details.

How can I suppress these errors ? I already tried redirecting to /dev/null and a few other things.

#...
[Service]
ExecStartPre=/path/to/some/script.sh

Solution

  • Credit to @CharlesDuffy add ExecCondition.