Here is my rc.local#!/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./bin/echo 12 > /sys/class/backlight/acpi_video0/brightness/bin/echo disable > /proc/acpi/ibm/bluetooth# Samsung at home/usr/bin/xrandr --newmode 1680x1050_60.00  146.25  1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync/usr/bin/xrandr --addmode VGA1 1680x1050_60.00/usr/bin/xrandr --output VGA1 --mode 1680x1050_60.00exit 0whose permission is -rwxr-xr-x.The first command works, I can set the brightness of my laptop's monitor. The following script is to disable bluetooth and to set resolution of my external monitor.Only the first command is correctly executed, not the others.I know that rc.local stops running when a command fails. However, I've tried to run it manually/bin/sh /etc/rc.localEverything seems to work correctly, the bluetooth is disabled and the resolution is set without problem. I've also tried to run the first command in terminal/bin/echo 12 > /sys/class/backlight/acpi_video0/brightnessecho $?It shows that the first command returns zero.So I don't understand why the system doesn't run all the commands in rc.local. I really need it, especially for the first 2 lines which need root permission.
Why doesn't rc.local run entirely
x11;startup;init script
/etc/rc.local is executed before the X server starts, so it has no access to any GUI features. The xrandr commands cannot have any effect.Put the xrandr commands in a different file, which runs when your GUI session starts. The file depends on your desktop environment.