Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run as a service? #1

Open
millercentral opened this issue Jul 17, 2024 · 5 comments
Open

Run as a service? #1

millercentral opened this issue Jul 17, 2024 · 5 comments

Comments

@millercentral
Copy link

Thanks for this. If I want to load my custom fan curve at system start and have it maintained while the system is active can I run the fan.sh script as a service? If so, could you provide an example of what that could look like?

@RoversX
Copy link
Owner

RoversX commented Jul 18, 2024

Thanks for this. If I want to load my custom fan curve at system start and have it maintained while the system is active can I run the fan.sh script as a service? If so, could you provide an example of what that could look like?

Thanks, I think it is possible, you can choose to launch fan.sh or nvidia_fan_control.py when system start, here is an example, I think it should work.(Which means I haven't tested it yet.)

Create and edit a systemd service file:

sudo nano /etc/systemd/system/nvidia_fan.service
[Unit]
Description=NVIDIA Fan Control
After=multi-user.target

[Service]
Type=simple
ExecStart=/path/to/nvidia_fan_control_linux/fan.sh
User=root
Group=root
Restart=always

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl enable nvidia_fan.service
sudo systemctl start nvidia_fan.service
sudo systemctl status nvidia_fan.service

This should ensure the script runs with root privileges at start.

@millercentral
Copy link
Author

I'll give it a try, thanks!

@zdybak
Copy link

zdybak commented Aug 22, 2024

This worked for me on ubuntu 24.04 with my fan flickering evga 3060ti, thank you so much!

@bernhofer
Copy link
Contributor

if you have SELinux active (e.g., in Fedora) it can block the execution of the shell in the service from your home dir.
You can move it to e.g. /usr/local/bin by running sudo install -m755 ./fan.sh /usr/local/bin then you'll need to modify the service like this: ExecStart=/usr/local/bin/fan.sh.

Alternatively, you can just set ExecStart=/bin/bash -c 'cd /path/to/nvidia_fan_control_linux && source fan/bin/activate && python nvidia_fan_control.py'.

@Proxy13
Copy link

Proxy13 commented Nov 18, 2024

what we are looking for amazing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants