# portmap-wait 
# Note that this is called portmap-wait rather than rpcbind-wait because
# other packages rely on the portmap-wait name.

description "Start this job to wait until rpcbind is started or fails to start"
author "Clint Byrum <clint.byrum@canonical.com>"

stop on started rpcbind or stopped rpcbind

# Needed to make starting the job successful despite being killed
normal exit 2
task

# We know that we have more than one job that needs to wait for rpcbind and
# will make use of this service, so we need to instantiate.
instance $WAITER

script

  status rpcbind | grep -q "start/running" && exit 0

  start rpcbind ON_BOOT=y || true

  # Waiting forever is ok.. upstart will kill this job when
  # the rpcbind we tried to start above either starts or stops
  while sleep 3600; do :; done

end script
