- $USTD --pidfile "$pidfilepath" -s "$SOCKPATH" -o "$OUTDIR" >"$OUTDIR/ustd.log" 2>&1 &
- USTDPID="$(<$pidfilepath)"
- export UST_DAEMON_SOCKET="$SOCKPATH"
+ $UST_CONSUMERD --pidfile "$pidfilepath" -s "$UST_CONSUMERDSOCKPATH" -o "$OUTDIR" >"$OUTDIR/ust-consumerd.log" 2>&1 &
+ # ust-consumerd sets up its server socket
+ # ust-consumerd opens the pidfile, blocks because no one has opened it
+ # we open pidfile
+ # we block reading pidfile
+ # ust-consumerd writes to pidfile
+ # ust-consumerd closes pidfile
+ # we unblock reading pidfile
+ UST_CONSUMERDPID="$(<$pidfilepath)"
+ export UST_DAEMON_SOCKET="$UST_CONSUMERDSOCKPATH"