How do I add more than one command to /etc/rc.local?
Posted
by
Andreas
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Andreas
Published on 2012-10-29T11:43:48Z
Indexed on
2012/11/04
23:17 UTC
Read the original article
Hit count: 198
I want to add two power saving commands to /etc/rc.local file.
This to dissable bluetooth:
rfkill block bluetooth
And this to reduce screen brightness:
echo 3024 > /sys/class/backlight/intel_backlight/brightness
Separately added to /etc/rc.local they work but not both of them together like this:
#/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.
echo 3024 > /sys/class/backlight/intel_backlight/brightness
rfkill block bluetooth
exit 0
How do I add the two commands to get them properly executed at start-up?
Update
It turned out to be a timing issue. I fixed it by delaying the execution of the first command thus:
(sleep 5; echo 3021 > /sys/class/backlight/intel_backlight/brightness)&
© Ask Ubuntu or respective owner