On Ubuntu there must be several "autoexec.bat
" equivalents as I can see files like rc.local
which seem to do very little because the comments in the file says it doesn't work by default and I tried putting this command in there and it didn't work.
What I need to know is where I place this line.
echo 0 | /usr/bin/tee -a /sys/class/leds/smc::kbd_backlight/brightness
I also saw a rc.local
in /etc/init.d
as well but where I would place the cmd to make it work is a mystery as there are two functions in there so do I place it at the end of one of those functions or at the last line?
The command needs root permission to run and ideally it should be executed when the computer starts. As the command dims the keyboard of my MacBook Air.
Also, I would also like to know what file I'd need to edit if only a specific user would have this command run. As its an root command and I don't want to give admin or sudo access to that user I would like this command to execute as root when the user logs in and the user cannot stop that command from running.
Additional Discoveries
$HOME/.profile
is the login script but doesn't run as root, it works if you sudo the command but thats not want I need.
The /etc/profile
is weird, it doesn't execute at boot but when I go into a shell and execute sudo -i
" it runs as soon as the sudo goes into interactive mode
A neat short cut
With version 14.04, might have worked in earlier versions, you simply add a line to crontab using
sudo crontab -e
and add a line "@reboot whatevercommandwithfullpath" and it works. But with this new version I created a upstart script which is closer to how it should be done.
/etc/profile
is not supposed to execute at boot. It runs for all Bourne-style login shells, when the shells start. So, it runs together with.profile
files in users' home directories.