ivanacorovic
ivanacorovic

Reputation: 2867

How to write a script that runs after laptop is turned on?

I got a new laptop and I'm having issues with mouse cursor. It doesn't appear when I turn on the computer, so I need to execute these two commands in terminal, and then it's ok:

sudo modprobe -r psmouse
sudo modprobe psmouse proto=imps

Is there a way to write a script that would do this automatically after computer is turned on?

Upvotes: 0

Views: 180

Answers (2)

Tensibai
Tensibai

Reputation: 15784

I would more fix the module loading than executing a script.

Edit /etc/module and add a line like this:

psmouse proto=imps

This will tell the kernel to load this module with the proper parameter for your mouse You may also work on this with a file in /etc/modprobe.d containing something like:

install psmouse /sbin/modprobe psmouse proto=imps

But this question sounds a little off topic here...

Upvotes: 3

Jasper
Jasper

Reputation: 484

Add the commands to the file /etc/rc.local (Open this file with a text editor such as nano or vim).

This file is executed whenever the linux system boots.

However, it's probably a better idea to add the modules to the file "/etc/modules".

The /etc/modules file contains the names of kernel modules that are to be loaded at boot time, one per line. Arguments can be given in the same line as the module name. Lines beginning with a ’#’ are ignored.

You could try adding the module with the parameters there to see if that will work instead of having to remove and readding them using the modprobe cmd.

Upvotes: 2

Related Questions