6

Freshly installed 14.04, CoolerMaster Storm keyboard. I'm not at all concerned with being able to toggle/turn off the LED, I simply want the LED to turn on before login, i.e. while looking at the login screen, the LED should already be on.

I've set up a keyboard shortcut to run xset led 3, but this is less than ideal, as I have to be logged in in order to use the shortcut. I'd like this to happen automatically instead.

I'm very new to both Linux and scripting, so please ELI5/walk me through it. I know that you can run scripts at startup as per this, but I don't understand how to actually write the script or how to "put it in" /etc/rc.local. Do I simply fire up gedit and type xset led 3 directly into rc.local below the #comments, but above the exit 0? Do I make another script somewhere else and link to it in rc.local? Am I overthinking it (probably)?

In short, I'd like a more detailed explanation of what Mitch was saying in the link. Thanks for your time.

Baku9
  • 146
  • 4
    You should be able to simply add xset to the rc.local and it works, exactly as you said (before the exit 0). Make sure you edit rc.local with root privileges (open console and type sudo /etc/rc.local) and also ensure the file is executable (chmod +x /etc/rc.local) – willl459 Mar 18 '16 at 00:06
  • @willl459 Tried it, doesn't seem to work, unfortunately. Here's what my /etc/rc.local looks like: http://imgur.com/c2ZdCsi.

    I made sure it was executable: http://imgur.com/MavjohI

    – Baku9 Mar 18 '16 at 00:35
  • 1
    That looks correct. Try the answer by shvahabi here. Steps 1 through 7 seem to be right so try step 8, type sudo /etc/init.d/rc.local start on a terminal and restart. – willl459 Mar 18 '16 at 00:48
  • @willl459 Please don't recommend starting graphical programs with plain sudo. D: Use sudo -i. – Seth Mar 18 '16 at 01:20
  • Followed that link, shvahabi's steps didn't work for me, either (tried just doing step 8 then rebooting, then going through all of them and rebooting, neither had any effect). – Baku9 Mar 18 '16 at 04:45
  • The (somewhat) good news, though, is that I was able to get it to turn the led automatically at log-in by setting xset led 3 as a Startup Application. However, this still doesn't have the desired effect of doing the same thing, but without having to log in first (executing before login, rather than at login). – Baku9 Mar 18 '16 at 04:46
  • 1
    in rc.local put the full path to xset. You can figure it out by issuing which xset – jet Apr 12 '16 at 17:27

1 Answers1

1

Open the terminal, enter sudo -s to get root-access. Now enter nano /etc/rc.local, now edit the file so it looks 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.

xset led 3
exit 0

Now save with Ctrl + O, press enter and then Ctrl + X to exit.

Let's set the proper permissions using:

sudo chown root /etc/rc.local
sudo chmod 755 /etc/rc.local

Make sure everything works fine using:

sudo /etc/init.d/rc.local start

And now reboot.

CubeDev
  • 198