LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Laptop and Netbook (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/)
-   -   Performing an action every reboot (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/performing-an-action-every-reboot-349047/)

Zaulden 08-01-2005 08:45 PM

Performing an action every reboot
 
The touchpad on my Compaq Presario R3210US does not work on boot up unless I issue the following commands: rmmod psmouse, modprobe psmouse. Then it works immediately.

I've tried adding these commands to /etc/X11/xinit/xserverrc and it doesn't work on startup still unless I manually issue the commands. Where else should I look to add these to get my touchpad working all the time? I'm using Ubuntu 5.04.

Thanks in advance.

juanbobo 08-01-2005 11:26 PM

You could put those commands at the end of any executable file in the /etc/init.d directory or make your own and chmod +x it.

Zaulden 08-02-2005 05:05 PM

In my init.d directory, I made a file called mouseinit and put the following code inside it:
Code:

rmmod psmouse
modprobe psmouse

I then did a chmod +x on the file, but the touchpad still doesn't work unless I do a rmmod psmouse and modprobe psmouse manually.

Any other ideas?

juanbobo 08-02-2005 05:11 PM

Maybe the file has to start with "rc.", try putting those commands in any other script.

Zaulden 08-02-2005 05:14 PM

Tried renaming the file to rc.mouseinit - no go. Grr.

All the scripts in this directory in Ubuntu aren't in a rc.name format. I'm thinking maybe Ubuntu loads stuff a bit differently than other distros? I know in Slackware I had an easy time loading commands on bootup by adding lines to my rc.local file.

DaveAtFraud 08-02-2005 06:44 PM

Traditionally stuff like this should just be added to /etc/rc.d/rc.local. For my HP Pavilion the magic to making the touchpad (Synaptics) work is to execute the following command when the system boots:

echo -n "reconnect" > /sys/bus/serio/devices/serio0/drvctl

No reason you can't add your rmmod and modprobe commands instead. rc.local gets executed *after* all other initialization scripts (the stuff in /etc/init.d). This should still be prior to X if you boot in graphical mode.

Zaulden 08-03-2005 08:14 AM

In my Ubuntu install, I don't have a /etc/rc.d/ directory.

Instead, I have a rc0.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, rc6.d, and rcS.d. Also, in all of these directories, there is no rc.local file.

Could anyone be of any further assistance?

Vgui 08-03-2005 10:31 AM

At worst you could try appending it to your actual runlevel script (so it starts as part of the normal runlevel X process).

Zaulden 08-03-2005 10:39 AM

I actually found out from a previous thread how to do this just now...
http://www.linuxquestions.org/questi...hreadid=346690

I followed the first technique, which involved making my own rc.local file, but it seems there is also a bootmisc.sh which I can append to with commands, but that file seems pretty full of nested ifs, so I'm not sure where to put extra commands.

Either way, I finally got it working, so if anyone else ever has this problem with Ubuntu... check out that thread.

germanyzulu 08-03-2005 05:28 PM

I don't mean to take over this thread but as it seems Zaulden has fixed his problem...I have another question:

I thought it might work to put the commands into a cron job (system wide /etc/crontab or personal ~/crontab) with the "@reboot" tag like so (See "man 5 crontab" for the "@reboot" tag)

But I wasn't sure how soon after reboot the job would run, so I tested it:

Code:

user@localhost:~$ cat /etc/crontab
[...]
@reboot root /usr/bin/uptime

user@localhost:~$ cat ~/crontab
@reboot /usr/bin/uptime

user@localhost:~$ crontab -u user ~/crontab
user@localhost:~$ shutdown -h 2                          # 2 minutes to let the system wide crontab to load

However neither one worked!!!

Anyone know how i should have done this ???


All times are GMT -5. The time now is 09:42 PM.