Ubuntu – rc.local is not always executed upon boot

bootscripts

Hey,
I have some weird problem with the rc.local file which is located in /etc/rc.local the thing is that it is not always running when I boot up the laptop. Maybe every second time, I haven't counted. Anyway when that happens I have to manually go to terminal and type sudo /etc/init.d/rc.local start, which kinda kills the purpose of having this script. Anyone know what the problem could be?

EDIT

Since this wasn't obvious. This is an issue where I make a fresh boot up. Which mean I have shut down the computer. And next time when I boot up the computer, the rc.local file is randomly deciding whether it will automatically start or not.

Here's a copy of what my rc.local file contains

echo -n 255 > /sys/devices/platform/i8042/serio1/serio2/sensitivity 
echo level 2 > /proc/acpi/ibm/fan
touch /home/starcorn/Desktop/foo

rfkill block bluetooth
exit 0

Best Answer

Place the touch on the first line, and make sure it touches a file in a directory where everyone has write access.

Then, log any errors, for example like:

echo -n 255 > /sys/devices/platform/i8042/serio1/serio2/sensitivity 2> /your/log/file
echo level 2 > /proc/acpi/ibm/fan 2> /your/log/file
touch /home/starcorn/Desktop/foo >> /your/log/file 2>&1

rfkill block bluetooth >> /your/log/file 2>&1
exit 0

The >> logfile 2&>1 tells the shell to log error messages to the same file as normal output. The 2> logfile only logs the errors.

What happens with these changes?

Related Question