nagisa / msi-rgb

Linux utility for controlling RGB header on select MSI motherboards
ISC License
418 stars 40 forks source link

Can't off the lights at startup. #82

Closed Adelaide-b closed 5 years ago

Adelaide-b commented 5 years ago

Ok, so I have made a bash script, located in /home/prash/.config/autostart/Scripts/MyScript: echo "Offing lights..." cd msi-rgb ./target/release/msi-rgb 00000000 FFFFFFFF 00000000 -x echo "Lights are off."

I also made a .service file I put in /etc/systemd/system: `[Unit] Description=run MyScript with root permissions at boot

[Service] Type=oneshot ExecStart=/bin/sh '/home/prash/.config/autostart/Scripts/MyScript'

[Install] WantedBy=multi-user.target`

I did make sure that the MyScript.sh is executable with sudo chmod 775 MyScript I also made sure that the .service is enabled with systemctl enable MyScript

Here is the output from systemctl status MyScript: ● MyScript.service - run MyScript with root permissions at boot Loaded: loaded (/etc/systemd/system/MyScript.service; enabled; vendor preset> Active: inactive (dead) since Thu 2019-10-03 22:16:53 CEST; 13min ago Process: 530 ExecStart=/bin/sh /home/prash/.config/autostart/Scripts/MyScript> Main PID: 530 (code=exited, status=0/SUCCESS)

I hope I provided enough info for you guys to help me.

nagisa commented 5 years ago

Does msi-rgb work without systemd? ./target/release/msi-rgb will be relative to your current working directory, not to your script, so you need to specify the full path to the executable as well.

Adelaide-b commented 5 years ago

Does msi-rgb work without systemd? ./target/release/msi-rgb will be relative to your current working directory, not to your script, so you need to specify the full path to the executable as well.

So if I do cd /home/prash/msi-rgb it should work? I will try when I get home. Thanks for giving such a quick reply.

Adelaide-b commented 5 years ago

@nagisa I just changed the cd msi-rgb line in the script to cd /home/prash/msi-rgb and it works like a gem. It shuts down the rgb even earlier than I expected; at the login screen instead of after logging in, which is probably because I told the .service file that it is WantedBy=multi-user.target. Thanks! Can I close the issue now?