<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello,</p>
<p>I've first posted on stackoverflow but couldn't get any usefull
answer (gomenasai 😅)<br>
</p>
<p>I'm trying to start a task when bluetooth is ready on a raspi
(running raspbian 10 - buster) with systemd. I've added the file
/etc/systemd/system/my.service with this content</p>
<blockquote>
<pre><code>[Unit]
After=bluetooth.target
Requires=bluetooth.target
[Service]
Type=idle
ExecStart=/root/my.sh
[Install]
WantedBy=multi-user.target
</code></pre>
</blockquote>
<p>Then I used the <font face="monospace">sudo systemctl enable
my.service</font> command, and rebooted.<br>
</p>
<p>After reboot I look at services launch order with <code>systemd-analyse
plot</code>, and it turns out that my service starts after
bluetooth.target as expected. But bluetooth.target gets started
very early (attachment bt1.svg). And <code>systemctl show
bluetooth.target</code> tells me 'After=bluetooth.service' so
why is bluetooth.target point is reached way before
bluetooth.service?</p>
<p>I precise that if I use</p>
<blockquote>
<pre><code>[Unit]
After=bluetooth.service
Requires=bluetooth.service</code></pre>
</blockquote>
<p>it's also weird: my service is started early, way before
bluetooth.service and bluetooth.target (which as expected is
activated rigth after bluetoothd is ready, attachment bt2.svg).<br>
</p>
<p>Could you tell me what's wrong?</p>
<p>Sincerely<br>
<code></code></p>
<div class="moz-signature">-- <br>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title></title>
<font face="DejaVu Sans"><b><font color="#1f497d">Gildas Bayard</font></b><br>
Ingénieur de Recherche<br>
Responsable Sécurité des Systèmes d'Informations<br>
Coordonnateur pour la Protection du Potentiel Scientifique et
Technique<br>
<i>Télétravail le mercredi</i><br>
Laboratoire HEUDIASYC - UMR CNRS 7253<br>
UTC Centre de Recherches de Royallieu<br>
BP 20529 - 60205 Compiègne Cedex<br>
Tél. 03 44 23 46 71</font> </div>
</body>
</html>