I've been searching around for an hour or two but cannot seem to find the correct solution. Here's the situation:
I have multiple services. I start up Service A, which runs a docker container. That application starts up and then writes a file
isActive to a mounted directory in the file-system.
I have a Service and Path unit file B. watch.path waits until the
isActive exists, which runs watch.service and that service file just echo's out "
This portion of the logic works fine. I use
sudo journalctl -xefb and I watch Service A start up, finish it's registration and then write a file. I then can see that the Service B unit files start, echo out, and finish.
I then have multiple other service files (Service C/D/E/F) that
After the Service B watching service. However, Services C/D/E/F are starting way before Service B starts/finishes.
Here is my current 'watching` service:
# watch_for_client.path [Unit] Wants=A.service After=A.service [Path] PathExists=/A/B/C/d.txt [Install] WantedBy=multi-user.target # watch_for_client.service [Unit] After=A.service [Service] Type=oneshot ExecStart=/bin/echo "file found"
And then in the other files, I have
[Unit] Requires=wait_for_client.service After=wait_for_client.service [Service] ... Type=simple ... [Install] WantedBy=multi-user.target