I am trying to use a script, nvidia-fan-controller, to control the GPU temperature on my system (Arch Linux). This works perfectly, except when I try run through systemd, I get the error
nvidia-settings control display is undefined
After some investigation, it seems like the issue comes from the .Xauthority file used in the service. nvidia-settings, used by the script, depends on the .Xauthority file, but also needs root permissions to change the fan speed. Is there any way to give root an .Xauthority file that can be accessed through systemd? The service currently points at this file for the sysadmin user I used to install the service, and consequently does not run when any other user is logged in.
I have tried creating a user service, but this does not work as the command must be run as root.
sudoto enable it to be ran as root.