title: Script Appears to run too Early, following bluetooth.target
body: <p>I am running Ubuntu 20.04, and have a small service file to run a script to connect a bluetooth speaker on powerup, and following a sleep-wakeup,.. the service file looks as follows</p>
  <pre><code>[Unit]
  Description=speaker bluetooth connect systemd, respawn, after bluetooth
  After=bluetooth.target pulseaudio.target
  
  [Service]
  ExecStart=/home/user/scripts/bluetoothspkrconnect.sh
  Restart=on-failure
  
  [Install]
  WantedBy=multi-user.target
  </code></pre>
  <p>This process essentially works,.. however the speaker only connects the bluetooth device if I insert a 'delay 20' second before the connection script runs the connect line,</p>
  <pre><code>#!/bin/bash 
  sleep 20
  #
  bluestatus=`bluetoothctl info  E5:28:E9:D8:12:CC | grep Connected | grep yes`
  echo $bluestatus
  
  if [ -z &quot;$bluestatus&quot; ]
  then
  #Now we issue the commend to reconnect the speakers
  bluetoothctl connect  E5:28:E9:D8:12:CC
  fi
  </code></pre>
  <p>I see the <em>delay</em> as a messy <em>cludge</em>,.. I initially thought I should wait on pulse audio starting,.. but having included 'pulseaudio.target',.. this does not fix the issue,..</p>
  <p>Can anyone offer insight as to which targets I might wait on, before running the script...</p>