Hey guys, thanks in advance for your time! I have a question about how the /etc/rc*.d machinery works.
My box setup: MacBook 5.1 running Ubuntu 8.10. No significant package changes.
My problem: keyboard backlight is ON by default. It goes on whenever the system comes online, whenever it returns from suspend and whenever i unplug power. I want it to be off by default. I want to learn more about Ubuntu as a side-effect.
My planned approach: add a script into the /etc/rc5.d directory that echoes 0 to the right /sys.. file. I can do this by hand - just want it to happen automatically. My first attempt at this didnt work - so I decided to create a little debugging widget.
I've created the following general-purpose script in my home directory called "runmark_home". All it does is get the current timestamp and creates an empty "marker file" with the timestamp as the name.
Code:
#!/bin/sh
if [ $# -ne 0 ]; then
NAME=$1
else
NAME=UNK_RUN
fi
FILENAME=`date +%Y%m%d_%H_%M_%S`
FILENAME="/home/MYUSERNAME/"${FILENAME}_${NAME}
/usr/bin/touch $FILENAME
So from my home directory I can do:
Code:
$ scripts/runmark_home testrun
$ ls 20090225_00_42_04_testrun
20090225_00_42_04_testrun
...voila the file is created!
Let's try to get this to be run once every time the system starts up. That should be easy enough... Some random searching, investigation,etc, makes /etc/rc5.d look promising. So here's what I did:
Code:
$ cat /etc/init.d/samplescript
#! /bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
/home/MYUSERNAME/scripts/runmark_home samplescript
exit 0
$ ls -l /etc/rc5.d/S99sample
lrwxrwxrwx 1 root root 24 2009-02-25 00:13 /etc/rc5.d/S99sample -> /etc/init.d/samplescript
Problem: no "mark file" appears when I boot the system up. Tried a few times.
Now my limited knowledge of Linux is probably immediately apparent. I appreciate any advice you may offer:
Why doesn't the file appear?
How can we debug/trace this? Does the script get invoked? What part of the script fails?
How / how else do I go about figuring out keyboard backlight problem (might be a question for mactel)?
Thank you very much!!!
Bookmarks