Démarrer un programme lors du boot
Bonjour,
Je rencontre un petit soucis pour démarrer un programme python au démarrage de ma board.
J'utilise systemd, j'ai donc créé le service suivant :
# android.service
Code:
1 2 3 4 5 6 7 8 9 10
| [Unit]
Description=Android BLE connexion
After=multi-user.target
[Service]
Type=idle
ExecStart=/usr/bin/python2 ~/bluetooth-RPi-wifi.py
[Install]
WantedBy=multi-user.target |
J'éxécute les commandes suivante ensuite
Code:
1 2
| sudo systemctl daemon-reload
sudo systemctl enable android.service |
Au redémarrage j'obtiens l'erreur suivante :
Code:
1 2 3 4 5
| Aug 16 10:51:55 technexion systemd[1]: Started Android BLE connexion.
Aug 16 10:51:56 technexion python2[769]: /usr/bin/python2: can't open file '~/bluetooth-RPi-wifi.py': [Errno 2] No such file or directory
Aug 16 10:51:56 technexion systemd[1]: android.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Aug 16 10:51:56 technexion systemd[1]: android.service: Unit entered failed state.
Aug 16 10:51:56 technexion systemd[1]: android.service: Failed with result 'exit-code'. |
Je comprend qu'il ne trouve pas le fichier, pourtant quand je lance à côté :
Code:
1 2
|
/usr/bin/python2 ~/bluetooth-RPi-wifi.py |
Le programme se lance bien, je sèche un peu pour le coup .. si vous avez une idée je suis preneur
Merci