Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
A different approach is: try ironhide. Solved the problem with my gt555m. –  modosansreves Feb 29 '12 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/… –  AnPel Feb 29 '12 at 12:34

2 Answers 2

up vote 3 down vote accepted

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, and 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".

share|improve this answer
4  
Startup Applications run when you log in, not when the system boots. –  Richard Holloway Mar 1 '12 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 '12 at 18:39

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.
share|improve this answer
    
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? –  AnPel Feb 29 '12 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 '12 at 14:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.