It would be really nice to have an utility that waits until a unit is
transitioned from the activating state. My problem is that I wanted to
replace in a shell script a sequence like:

sudo -u some_user ssh -f port_forwarding host
use_forwarded_ports
kill hopefully rightly guessed ssh PID

with something like

sudo systemd-run --uid user --service-type=forking ...  ssh -f
port_forwarding host
use_forwarded_ports
sudo systemctl stop unit_name

as that is easier to make reliable. However, this does not work as I
expected as systemd-run does not wait for the ssh -f unit to transition
from the activating state indicating that port forwarding is established.
So I need to implement own wait or polling.


On 31 March 2015 at 05:51, Andrei Borzenkov <arvidj...@gmail.com> wrote:

> В Mon, 30 Mar 2015 09:48:25 +0200
> Igor Bukanov <i...@mir2.org> пишет:
>
> > As I understand, the systemd-run utility returns immediately even with
> > --service-type=forking. What is the proper way then to wait using a shell
> > until the main service process forks the child and exists signaling
> > initialization?
>
> It is not limited to forking. systemd-run simply queues request to
> start unit, same as systemctl does. It would need to actually wait
> until systemd reports that unit is started.
>
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to