Score:1

How to run a .sh file on startup

us flag

I'm using Ubuntu 20.04 LTS. In my laptop, Bluetooth is not enabled by default. It shows that NO Bluetooth found. Plug in a dongle to use Bluetooth. I installed Bluez bluetooth and it activates my Bluetooth but I have to run some commands in order for it to activate every time I turn on my laptop.

Commands I have to run are,

sudo /etc/init.d/bluetooth start
systemctl start bluetooth
sudo modprobe btusb 
sudo systemctl start bluetooth.service
sudo service bluetooth restart
sudo modprobe rtbth

My questions,

  1. How to run these commands automatically when the laptop turns on.
  2. Sometimes even it is activated, it shows Connection failed. Resources not ready. and It won't connect no matter how much I wait.

I tried, Putting these commands in a .sh file and including that inside rc.local and I used crontab too. Nothing seems to work.

Kindly help me in figuring it out.

Thanks.

user852451 avatar
sa flag
For the Bluetooth issue, A [bios upgrade](https://askubuntu.com/questions/875901/no-bluetooth-found-plug-in-a-dongle-to-use-bluetooth/1359402#1359402) resolved the issue for me.
darth_epoxy avatar
nl flag
Can you confirm that the script is NOT running? Execute `dmesg` and see if your script is in face called or not. Don't post it, just let us know if you found it in there.
Avatar avatar
us flag
Yeah, I don't see it running.
waltinator avatar
it flag
Please [edit] your post to add new information, properly formatted. Information added via comments is hard for you to format, hard for us to read and ignored by future readers. Please click [edit] and add that vital information to your question so all the facts we need are in the question. Please don't use Add Comment, since that's our uplink to you. All facts about your system should go in the Question with [edit]
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.