0

So I am currently using Ubuntu in my Lenovo 330 15ikb(Model 81DC) I am using a script https://github.com/anitaggu/ikbdop/ to disable my keyboard but I don't want to type the commands every time I open my laptop by cold booting.

Commands:-

./ikbdop.sh attach #to attach the internal keybord
./ilbdop.sh detach #to detach the internal keyboard

Is there a way to run the detach command every time I turn on my laptop or your can say how to turn that script to an startup application with automatic detach command?

Note:- I am not a professional so please write in a simple language.

  • Welcome to Ask Ubuntu. Zorin OS is off-topic here, so your question will probably be closed as off-topic, but you can try to ask on Unix & Linux Stack Exchange. Just to point you in the right direction, look into creating a service that runs on startup on Linux. – cocomac Oct 06 '21 at 03:57
  • Oh OK. Your original post said Zorin OS, but if you ended up using Ubuntu, you are all good. I've also removed my off-topic flag as you are using Ubuntu. Sorry for any misunderstanding. – cocomac Oct 06 '21 at 04:03
  • Man I accidentally deleted the previous comment but anyways I don't get it how do I turn that script to startup program with automatic detach command. – Mine Easter Oct 06 '21 at 04:04
  • @MineEster I added an answer explaining one possible way. Some other possible ways are in this question. – cocomac Oct 06 '21 at 04:15

1 Answers1

0

There are many ways to run a script at startup, but here is one way using cron.

Create a script somewhere on your disk, say, /home/you/myscript.sh, and put the following in the script. This will be the commands that are ran every time you startup your computer, so double-check that they are correct. The first line (#!/usr/bin/env bash) tells Ubuntu to use Bash to run this script.

#!/usr/bin/env bash
/full/path/to/ikbdop.sh attach
/full/path/to/ilbdop.sh detach

Save the script where you want. Make it executable (chmod +x myscript.sh). Run crontab -e to edit your cronfile. Add a line to it that says @reboot /full/path/to/script.sh (replace the path with the location of your script, of course).

cocomac
  • 3,394