Running a startup script without using rc.local

  • OS version:
  • Kernel version:
    Linux punjistick-ux482 5.10.0-5parrot1-amd64 #1 SMP Debian 5.10.24-5parrot1 (2021-03-20) x86_64 GNU/Linux

Hey dudes and dudettes. Brand new to Linux, and new to Parrot. I’m using an ASUS Zenbook (UX482EA), and recently installed a kernel module to enable backlight adjustment support on the built-in second monitor. Works as advertised, however I’m hung up on the next step, which is running a script on startup that will allow me to create a hotkey, alias, or some form of shortcut that doesn’t involve using sudo each time. (for reference, here’s the module)

In the instructions for the module, Plippo mentions adding a line to “/etc/rc.local”, and then I can run a script he made to finally be able to adjust the monitor’s backlight simply and quickly.

However, as I’m trying to learn Linux as I go, I decided to look into what I’m doing first. I came across several posts saying using rc.local is deprecated, including a post here on the Parrot boards, and this ABSURDLY long post stating to “forget about rc.local”.

So, finally, my actual question. What is the “proper” way to get what I need accomplished here, if not using rc.local? Per Plippo’s instructions, I need to add:
sudo chmod a+w '/sys/class/leds/asus::screenpad/brightness'
to /etc/rc.local, and then download his script and make it an executable using:
cd /usr/bin sudo wget '' sudo chmod a+x screenpad

I’m by no means a coder and this is all very new to me, but if there is a newer or more proper method to accomplishing what I’m trying to do above, I’d love to learn it.

There are 3 ways

  1. Run as system service, which uses systemd, sysvinit, …
  2. Run as process using cronjob
  3. Run as process using startup applications menu

You are asking for a driver so it must be loaded by kernel, or at least start as a service.

1 Like

I honestly had no idea what to even search for in regards to alternatives so this helps quite a bit, appreciate the response!

1 Like

So I’ve been looking around all night into the different methods you suggested, and tried (and failed) several times.

I am coming on to Linux with 0 coding or scripting knowledge, so forgive my cluelessness here. I think what I’m trying to do is pretty simple I just honestly don’t know what I am looking for in order to make it happen.

As far as I understand it, the driver or kernel module is already installed and working as intended. If I type:

sudo chmod a+w '/sys/class/leds/asus::screenpad/brightness'

I can then type:

screenpad [1-9 or 'off']

and my 2nd monitor backlight will adjust accordingly.

What I’m trying to do is add:

sudo chmod a+w '/sys/class/leds/asus::screenpad/brightness'

to some form of startup script so that command automatically runs on boot and gives the module root permissions, so I don’t have to enter a password at the start of each boot to simply adjust brightness (which would then also let me add that brightness command to a shortcut).

I’m having trouble figuring out how to go about doing this, seems like something that is likely rather simple but I just don’t know what I’m searching for to learn how.

1 Like

After much reading I finally figured this out using systemd as you recommended. Thank you for pointing me in the right direction! You’ve saved both my eyes and my laptop’s battery life lol.

Not sure if there’s a proper way for me to close this thread, or just let it run the 4 months.

Thanks again!

Glad you solved it.

1 Like