LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Re: Script and Making it Executable (https://www.linuxquestions.org/questions/linux-newbie-8/re-script-and-making-it-executable-945995/)

Chiff 05-20-2012 09:00 AM

Re: Script and Making it Executable
 
Hi,
I have a Asus UX31E laptop and this (below) is one of the fixes for
it. I have NO idea how to go about it. Can some one please give
step by step advice.

The source of the following is:
https://help.ubuntu.com/community/As...ok#BIOS_Update


Suspend, Hibernate, Shut-down and Reboot

The kernel USB 3.0 (and sometimes 2.0) modules needs to be unloaded before suspending, and in kernels prior to 3.1 X also needs to disable/enable DPMS to get the screen back on resume. Save the following script as /etc/pm/sleep.d/20_zenbook (and make it executable):

IconsPage/warning.png If this workaround not used, there have been reports that the laptop's memory controller setting may be screwed. After an incorrect suspend, if the corruption happens, many memory blocks starting with ~1G will be corrupt. Good way to see it is to use "memtest86+". The only way to fix controller setting is to open the case and plug off the battery. Please note that on this ultrabook the battery is not a user serviceable part and this could mean that by opening you can get your warranty void! If you start Windows or Linux with a corrupted controller, you will get system crashes or/and damaged file system. More info here: https://bugzilla.kernel.org/show_bug.cgi?id=42728 and https://bugs.launchpad.net/ubuntu/+s...ux/+bug/962798

For kernel 3.1 or newer (Ubuntu 12.04 LTS):

EHCI_BUSES="0000:00:1a.0 0000:00:1d.0"
case "${1}" in
hibernate|suspend)
# Switch USB buses off
for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/unbind
done
;;
resume|thaw)
# Switch USB buses back on
for bus in $EHCI_BUSES; do
echo -n $bus > /sys/bus/pci/drivers/ehci_hcd/bind
done
;;
esac


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So how do you put this in a script file and make it executable so that it
runs each time the computer starts up? Does it still run if one uses a different desktop other than say Gnome? Will it work under em, XFCE or KDE?

Thanks heaps for the kind help.

qweeak 05-20-2012 09:45 AM

My suggestion would be put that script in /etc/rc.local file.

Chiff 05-20-2012 10:43 AM

Quote:

Originally Posted by qweeak (Post 4683161)
My suggestion would be put that script in /etc/rc.local file.

I understand copy and paste commands.

So I copy the text into a text editor

and then WHAT ???

What does one save it as eg: scriptfile.?
How does it run every time one boots ?
What is the difference between a text file and a Script file?

As this is a Major issue with the hardware why is not in the latest Kernel ?
The Asus UX31E has been out for some time. I would have thought that all the
fixes would be in the OS. Can someone please put them in and all the other
issues from the source page which is in the first message. THANKS HEAPS.

Sorry for the funny questions but if I don't ask I won't know and I'll bet
there are many on this board who don't know too whom this will help out.

THANKS heaps for your kind help.

qweeak 05-20-2012 02:20 PM

I'm not sure this will work, but worth trying. Try copying the specified contents into /etc/rc.local and reboot the lap. This file is executed every time the system is booted.

What is the difference between a text file and a Script file?

script file does some action for you. It usually have permission of 755. Text file simply stores data for you.

As this is a Major issue with the hardware why is not in the latest Kernel ?

I don't think this is a kernel issue. You should ask the Ubuntu guys about this.

Chiff 05-20-2012 05:09 PM

What file extension do I use? .txt or ???

xjonquilx 05-20-2012 06:27 PM

For a script you use the extension .sh

For a text file you use the extension .txt

You also need to make that script executable.

chmod +x /path/to/script.sh

Chiff 05-20-2012 07:52 PM

Quote:

Originally Posted by xjonquilx (Post 4683483)
For a script you use the extension .sh

For a text file you use the extension .txt

You also need to make that script executable.

chmod +x /path/to/script.sh

Thanks.

What directory do I save the script in ?

273 05-20-2012 08:33 PM

The page you linked to tells you where to save the script and what to name it. It should be in the directory /etc/pm/sleep.d/ and be named 20_zenbook.
You can create it by typing the following in a terminal:
Code:

sudo gedit /etc/pm/sleep.d/20_zenbook
Then pasting the code and saving the file. To make it executable you can type the following in a terminal:
Code:

sudo chmod +x /etc/pm/sleep.d/20_zenbook

Chiff 05-21-2012 08:11 PM

Thanks heaps for your kind help.

273 05-21-2012 08:14 PM

You're welcome. If your problem is solved, please remember to mark the thread solved. :)


All times are GMT -5. The time now is 01:44 AM.