7

My problem in a nutshell is that I have to run a script every time I use my computer so I'm trying to automate the process a bit.

My system has the nvidia gt540m vga card. The card is dual. It has one high end card for demanding tasks, and it uses the low end onboard card for everything else.

Ubuntu at this time does not support this type of vga card, and it powers them both at all times, when only using the onboard one.

This results in very low battery life time.

I am rather new to ubuntu so I had to follow a ton of tutorials before actually finding a script to solve the problem.

I downloaded an acpi_call folder to the directory /home/anpel, and with the following commands, I kill the card:

cd /acpi_call
sudo insmod acpi_call.ko
sudo ./test_off.sh

Next step, since I had to manually run the commands each and every time I booted, was to make a shell script on my desktop, which I run, it prompts me for my password, and after providing it, it kills my card. The script looks like this:

cd ~/acpi_call
sudo insmod acpi_call.ko
sudo ./test_off.sh
echo VGA card dead
exit

Now, I am trying to make my system run this script every time my computer boots, so I don't have to do it manually every time.

I don't have the experience to change anything to my system without at least some guidance, because I think it's highly likely I will mess everything up, and I have no idea how to clean up my mess, so I haven't really tried anything, but I am reading that adding my script to the /etc/rc.local file will get the job done.

Is that true or is there something else I have to try?

---- EDIT -----

I use ubuntu 11.10, sorry for not mentioning that.

2
  • A different approach is: try ironhide. Solved the problem with my gt555m. Feb 29, 2012 at 12:03
  • I used this guide and installed bumblebee. Looks like this solved my problem though I will have to see how my battery life time changes in the next couple of days. ivegotavirus.com/blog/2012/01/23/…
    – ppp
    Feb 29, 2012 at 12:34

2 Answers 2

9

The correct place for scripts that are to be run at boot is to call the script from /etc/rc.local

The comments in the file sum it up:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
2
  • Is it run in the root directory? I mean if my acpi_call folder is in /home/anpel will I have to copy it to /root so that cd /acpi_call gets to the correct folder containing the modules?
    – ppp
    Feb 29, 2012 at 12:51
  • You can place your script anywhere you want. why do't you just give the absolute of acpi_call directory.
    – Abhijeet
    Feb 29, 2012 at 14:56
3

You could run your script file as a Startup Application (System - Preferences - Startup Applications in Ubuntu 10.04 LTS - not sure where the equivalent is in 11.10).

For example, to run the inosync utility on bootup, I added an entry in Startup Applications with

Name=inosync
Command=/home/toaster/inosync.sh
Comment=Mirror DataDisk to Barracuda_01 

The bash script file inosync.sh must be enabled to execute. This can be achieved using sudo nautilus in Terminal, navigating to the file, right-clicking and selecting Properties, going to the Permissions tab, and checking "Allow executing file as a program".

2
  • 4
    Startup Applications run when you log in, not when the system boots. Mar 1, 2012 at 13:32
  • Thank you for this clarification. Since I always log in when I boot the system, Startup Applications works just fine for my application.
    – CentaurusA
    Mar 3, 2012 at 18:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .