I am trying to create a custom script, which has to run automatically during boot. The custom script is running a python script which is using bluetooth. When I run this following line :
systemctl start myCustomService.service
The script works perfectly !
However when I reboot the computer, I have this following error :
[localhost]# systemctl status myCustomService.service -l
myCustomService.service.service - MycustomScript program
Loaded: loaded (/etc/systemd/system/myCustomService.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Thu 2019-02-21 15:03:38 CET; 1min 39s ago Process: 821 ExecStart=/.../mycustomScript.sh (code=exited, status=1/FAILURE) Main PID: 821 (code=exited, status=1/FAILURE)
Feb 21 15:03:38 localhost mycustomScript.sh[821]: During handling of the above exception, another exception occurred: Feb 21 15:03:38 localhost mycustomScript.sh[821]: Traceback (most recent call last):
Feb 21 15:03:38 localhost mycustomScript.sh[821]: File "main.py", line 69, in
Feb 21 15:03:38 localhost mycustomScript.sh[821]: profiles=[SERIAL_PORT_PROFILE],
Feb 21 15:03:38 localhost mycustomScript.sh[821]: File "/usr/local/lib/python3.6/site-packages/bluetooth/bluez.py", line 266, in advertise_service
Feb 21 15:03:38 localhost mycustomScript.sh[821]: raise BluetoothError (*e.args)
Feb 21 15:03:38 localhost mycustomScript.sh[821]: bluetooth.btcommon.BluetoothError: error no advertisable device.
Feb 21 15:03:38 localhost mycustomScript.sh[1]: sample.service: main process exited, code=exited, status=1/FAILURE
Feb 21 15:03:38 localhost mycustomScript.sh[1]: Unit sample.service entered failed state.
Feb 21 15:03:38 localhost mycustomScript.sh[1]: sample.service failed.
My service is running after bluetooth services, hence, I don't understand why I have this error.
PS : I am using Centos 7