usando apenas uma unidade
Coloque TimeoutStartSec=infinity no arquivo da unidade e configure ExecStart= com um script como
#! /bin/bash
TIMEOUT=1000
test -f /path/to/testfile && sleep "$TIMEOUT"
exec /path/to/service/binary plus arguments
Isso não pode ser feito (de maneira útil) com ExecStartPre= , consulte man systemd.service :
Note that ExecStartPre= may not be used to start long-running processes. All processes forked off by processes invoked via ExecStartPre= will be killed before the next service process is run.
usando uma unidade auxiliar
Se você quiser fazer isso com o systemd "sozinho", você pode criar uma unidade auxiliar check_and_wait . Este recebe as entradas
TimeoutStartSec=infinity
ConditionPathExists=/path/to/testfile
ExecStart=/usr/bin/sleep 1000
RemainAfterExit=yes
A unidade principal recebe estas entradas:
Wants=check_and_wait
After=check_and_wait