Tohle by to mělo finálně řešit - udělal jsem tam malé úpravy
Kód: Vybrat vše
cat <<EOF > /storage/bt.sh
#!/bin/bash
while true; do
TEST=\`bluetoothctl info | wc -l\`
if [ \$TEST -ne 1 ]; then
sleep 1
continue
fi
bluetoothctl connect 20:20:00:0F:C4:3A 2>&1 > /dev/null
sleep 1
done
EOF
chmod +x /storage/bt.sh
cat <<EOF > /storage/.config/system.d/bt.service
[Unit]
Description=BT
[Service]
Environment="LANG=cs_CZ.UTF-8"
WorkingDirectory=/storage/
ExecStart=/bin/bash /storage/bt.sh
RestartSec=1s
KillMode=process
Restart=always
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
EOF
systemctl enable bt.service
systemctl start bt.service
Kód: Vybrat vše
LibreELEC (official): 9.2.0 (RPi.arm)
LibreELEC:~ # cat <<EOF > /storage/bt.sh
> #!/bin/bash
> while true; do
> TEST=\`bluetoothctl info | wc -l\`
>
> if [ \$TEST -ne 1 ]; then
> sleep 1
> continue
> fi
> bluetoothctl connect 20:20:00:0F:C4:3A 2>&1 > /dev/null
> sleep 1
> done
> EOF
LibreELEC:~ #
LibreELEC:~ # chmod +x /storage/bt.sh
LibreELEC:~ #
LibreELEC:~ # cat <<EOF > /storage/.config/system.d/bt.service
> [Unit]
> Description=BT
>
> [Service]
> Environment="LANG=cs_CZ.UTF-8"
> WorkingDirectory=/storage/
> ExecStart=/bin/bash /storage/bt.sh
> RestartSec=1s
> KillMode=process
> Restart=always
> SuccessExitStatus=143
>
> [Install]
> WantedBy=multi-user.target
> EOF
LibreELEC:~ #
LibreELEC:~ # systemctl enable bt.service
Created symlink /storage/.config/system.d/multi-user.target.wants/bt.service → /storage/.config/system.d/bt.service.
LibreELEC:~ # systemctl start bt.service
Kód: Vybrat vše
● bt.service - BT
Loaded: loaded (/storage/.config/system.d/bt.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-02-05 21:32:42 UTC; 1min 2s ago
Main PID: 378 (bash)
Memory: 948.0K
CGroup: /system.slice/bt.service
├─378 /bin/bash /storage/bt.sh
└─630 sleep 1
Feb 05 21:32:42 LibreELEC systemd[1]: Started BT.