Can't manage to start a task when bluetooth is ready with systemd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I've first posted on stackoverflow but couldn't get any usefull answer (gomenasai 😅)

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

[Unit]
After=bluetooth.target
Requires=bluetooth.target

[Service]
Type=idle
ExecStart=/root/my.sh

[Install]
WantedBy=multi-user.target

Then I used the sudo systemctl enable my.service command, and rebooted.

After reboot I look at services launch order with systemd-analyse plot, and it turns out that my service starts after bluetooth.target as expected. But bluetooth.target gets started very early (attachment bt1.svg). And systemctl show bluetooth.target tells me 'After=bluetooth.service' so why is bluetooth.target point is reached way before bluetooth.service?

I precise that if I use

[Unit]
After=bluetooth.service
Requires=bluetooth.service

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).

Could you tell me what's wrong?

Sincerely

--
Gildas Bayard
Ingénieur de Recherche
Responsable Sécurité des Systèmes d'Informations
Coordonnateur pour la Protection du Potentiel Scientifique et Technique
Télétravail le mercredi
Laboratoire HEUDIASYC - UMR CNRS 7253
UTC Centre de Recherches de Royallieu
BP 20529 - 60205 Compiègne Cedex
Tél. 03 44 23 46 71

Attachment: bt2.svg
Description: image/svg

Attachment: bt1.svg
Description: image/svg


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux