You can do this with systemd-service. In order to do so, you have to create a .service file in /etc/systemd/system and a script that actually executes the command.
I am not sure if my instructions are best practice but maybe somebody can correct me.
We first need the .service file. I created it with this command: sudo nano /etc/systemd/system/reload-bt-mod.service
In this file we need to have a [Unit], a [Service] and a [Install] section:
[Unit]
Description=Reload Bluetooth Kernel module
#You can enter a custom description here
[Service]
Type=oneshot
#This type is used for services that normally run only once
RemainAfterExit=no
#If set to yes, the service will be shown as run after it finished
ExecStart=/usr/local/bin/reloadbtmod
#This points to the script that we want to be executed
[Install]
WantedBy=multi-user.target
#When this service will be started
(More information on the parameters in this file can be found here. More information on WantedBy=multi-user.target here)
Save it and next lets create the script file that is executed. I did that with this command: sudo nano /usr/local/bin/reloadbtmod
And there we just add the content we need:
#!/bin/bash
#sleep 30s #Delays the execution by 30 seconds
sudo modprobe -r btusb
sudo modprobe btusb
We need this file to be executable and therefore enter this command:
sudo chmod +x /usr/local/bin/reloadbtmod
You can try if the script works by calling it from the terminal.
Now we only need to enable the systemd service (by enabling it, it will be started on system start):
sudo systemctl enable reload-bt-mod.service
Finished!
Now you can reboot and try if it works. Execute systemctl status reload-bt-mod.service
to get information on the service.
If it starts to early (however one would know that) you'd need to tinker with the WantedBy value or uncomment the #sleep 30s
in the script.