<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I think the main problem you are running into is the
DefaultDependencies option. When this is set to on, several
default dependencies are being enforced which make sure that at
least a basic system is up and running before anything else is
started. When you want to start something before the basic system
is up and running and want, for example, just to be sure that all
the filesystems are mounted, you can do something like this:</p>
<p> [Unit]<br>
DefaultDependencies=no<br>
After=local-fs.service<br>
Before=dependent_service1.service dependent_service2.service<br>
Conflicts=shutdown.target initrd-switch-root.target<br>
[Service]<br>
Type=oneshot<br>
TimeoutStartSec=600<br>
RemainAfterExit=yes<br>
ExecStart=<your startup script><br>
[Install]<br>
WantedBy=sysinit.target</p>
<p><br>
</p>
<p>Best regards,</p>
<p>Jan Hugo Prins</p>
<p><br>
</p>
<div class="moz-cite-prefix">Op 26-09-2023 om 12:50 schreef Mark
Rogers:<br>
</div>
<blockquote type="cite"
cite="mid:CADK3ZeHB9W2qKmuCuTPh5TmooSCoHwB6kmfY-sUXOscXnqbqxw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>I'm sure this is trivial but I've gone round in circles
without success.</div>
<div><br>
</div>
<div>I have a script which reads from an SQLite database and
generates various system configuration files - at the moment
these are dhcpcd.conf and wpa_supplicant.conf but this might
grow in future.</div>
<div><br>
</div>
<div>As such the only dependency the script has is that the
filesystem is up and running. But the script must complete
before anything that the script manages the configuration file
for.</div>
<div><br>
</div>
<div>My current unit looks like this:</div>
<div>[Unit]</div>
<div>Before=networking.service</div>
<div>After=local-fs.target</div>
<div><br>
</div>
<div>[Service]</div>
<div>Type=oneshot</div>
<div>ExectStart=/path/to/script</div>
<div><br>
</div>
<div>[Install]</div>
<div>RequiredBy=network.target</div>
<div><br>
</div>
<div>Where am I going wrong and what is the right way to do
this? <br>
</div>
<div><br>
</div>
<div>I've also tried Before=network-pre.target and
Wants=network-pre.target without success - it was that not
working that set me off trying to fix it.<br>
</div>
<div><span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div>
<div style="font-size:12.8px"><span
style="font-size:12.8px">Mark Rogers</span></div>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</body>
</html>