Results 1 to 5 of 5

Thread: Working executable /etc/rc.local doesn't start at boot

  1. #1
    Join Date
    Oct 2012
    Beans
    22

    Working executable /etc/rc.local doesn't start at boot

    Hi.

    Here is my /etc/rc.local
    Code:
    #!/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.     
    xbacklight -set 10
    rfkill block bluetooth
    exit 0

    And it is executable:

    Code:
    dan@dan530ubu ~ $ ls -l /etc/rc.local-rwxrwxrwx 1 root root 352 Mar 22 12:08 /etc/rc.local
    and the script is working - when I run it manually by "/etc/rc.local" it does sets backlight at 10% and turn off bluetooth. But the script does not start at boot. Any ideas? Thanks
    Last edited by Kotrfa; March 23rd, 2013 at 12:08 PM.

  2. #2
    Join Date
    Mar 2010
    Location
    Metro-ATL
    Beans
    Hidden!
    Distro
    Lubuntu 12.04 Precise Pangolin

    Re: Working executable /etc/rc.local doesn't start at boot

    a) having /etc/rc.local as 777 permissions is EXTREMELY dangerous. chmod 755 would be better.
    b) in a shell, your environment is shared. rc.local doesn't have much, if any, environment, so those programs are probably not found. Fully specify the path to the exact program.
    c) I don't know those programs, but is having root modify user settings like that a good idea? Would having those settings handled per-user be a better option?

  3. #3
    Join Date
    Oct 2012
    Beans
    22

    Re: Working executable /etc/rc.local doesn't start at boot

    Hi. Thanks for reply.

    a) I edited to 755 - you're right
    b) I wasn't sure what you mean, but I edited as this:
    Code:
    #!/bin/sh -e
    /usr/bin/xbacklight -set 10
    /usr/sbin/rfkill block bluetooth
    exit 0
    But nothing changed. Still same problem.
    c) I can't find any other solutions. rfkill sets bluetooth off and xbacklight sets brightness of display. They are even not "root" tools, user can run them by default without sudo. I used them a very long time.
    Last edited by Kotrfa; March 22nd, 2013 at 01:47 PM.

  4. #4
    Join Date
    Jun 2005
    Location
    Toronto, Canada
    Beans
    Hidden!
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Working executable /etc/rc.local doesn't start at boot

    xbacklight won't work in /etc/rc.local because it requires an active X environment which is not yet available when /etc/rc.local is run. You have two options:

    1. Add the xbacklight command to your Desktop Environment startup files when you login. This will delay the brightness change until you log in.

    2. Directly manipulate the backlight interface through /etc/rc.local which should affect the brightness right at startup. See here for more information on the backlight interface. After you identify your active interface, you can manipulate the brightness by echoing a value to the brightness file like this (as a user logged in):
    Code:
    echo <value> | sudo tee /sys/class/backlight/<interface>/brightess
    ...where <value> is a numeric value between 0 and the contents of /sys/class/backlight/<interface>/max_brightness
    .....and <interface> is the directory name of the valid interface

    Once tested and working, you can add it to /etc/rc.local, but since /etc/rc.local is run as root, there is no need for sudo. The command to enter in /etc/rc.local would look something like this:
    Code:
    echo <value> /sys/class/backlight/interface/brighntess
    Running the following command will identify your backlight interfaces and the current brightness values:
    Code:
    for interface in /sys/class/backlight/*; do echo $interface; cat $interface/brightness; cat $interface/max_brightness; done

  5. #5
    Join Date
    Oct 2012
    Beans
    22

    Re: Working executable /etc/rc.local doesn't start at boot

    Thanks for reply.
    First option I used to use. I just thought that rc.local is designed for this type of commands and I could run short starting scripts through that. So my "sudo rfkill bluetooth" is stored as a script at /usr/local/bin and I added to startup app at GNOME. And for brightness I used your variant and it work great, thank you. Solved

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •