Need to run command at startup

I am a bit of a newbie at Linux. I know the basics, but still learning. My system has the Corsair Commander Pro, which is configured in Windows 11, but on logging into Manjaro KDE the fans are running at the incorrect speeds (they need to be lower than Windows as the system doesn’t work as hard in Linux and the temps are generally better).

Running Kernel 5.16.18-1.

I am using OpenCorsairLink to control my system fans.

This is what I currently have to paste into terminal every time after booting into Linux having used Windows 11.

sudo opencorsairlink --device 1 --fan channel=0,pwm=60
sudo opencorsairlink --device 1 --fan channel=1,pwm=60
sudo opencorsairlink --device 1 --fan channel=2,pwm=60
sudo opencorsairlink --device 1 --fan channel=3,pwm=60
sudo opencorsairlink --device 1 --fan channel=4,pwm=60
sudo opencorsairlink --device 1 --fan channel=5,pwm=60

Is there any way to make this happen automatically on on Startup?

Also is there a way to run these commands with out sudo first?

Help will be greatly appreciated.

Hi @destructa,

Yes, to both your questions. But I’m wondering if the second one is necessary.

I’m recommend creating a script that contains the commands, then creating a systemd unit file to execute the script on startup. And AFAIK the systemd units run as root, so sudo shouldn’t be necessary.

First, let’s create the script to execute on startup, I’ll call it but feel free to adapt it as wished:

sudo touch /usr/local/

And let’s make it executable:

chown +x /usr/local/

Now, let’s open it with nano

nano /usr/local/

and insert the required commands:

#!/usr/bin/env bash

opencorsairlink --device 1 --fan channel=0,pwm=60
opencorsairlink --device 1 --fan channel=1,pwm=60
opencorsairlink --device 1 --fan channel=2,pwm=60
opencorsairlink --device 1 --fan channel=3,pwm=60
opencorsairlink --device 1 --fan channel=4,pwm=60
opencorsairlink --device 1 --fan channel=5,pwm=60

(Feel free to simply copy-and-paste it yourself.)

When done save, Ctrl+S, and exit, Ctrl+X nano.

Then it’s best to test the script, so reboot, and when you’d normally execute those commands, run the script:

sudo ./usr/local/

If it works satisfactorily, we can create the systemd unit.

To setup a systemd unit, we’ve got to create a file for it:

nano /etc/systemd/system/set-fans.service

(Again, I’ve called it set-fans.service but you’re welcome to adjust it, as long as you keep the .service extension.)

In nano editor paste the following text:

Description=Set fans



Note that we must specify RemainAfterExit=true so that systemd considers the service as active after the setup action is successfully finished.

When done save, Ctrl+S, and exit, <Ctrl+X nano. Now we should test and enable the unit to start at boot:

sudo systemctl enable --now set-fans.service

If you’ve got no errors, congratulations. Everything should work if you reboot now. So go ahead and do exactly that. Report back.



I am away from home until the weekend. I’ll give this a go then and report back.

Appreciate the response.