/etc/systemd/system/nvidia-tdp.timer
[Unit]
Description=Set NVIDIA power limit on boot
[Timer]
OnBootSec=5
[Install]
WantedBy=timers.target
/etc/systemd/system/nvidia-tdp.service
[Unit]
Description=Set NVIDIA power limit
[Service]
Type=oneshot
ExecStart=/usr/bin/nvidia-smi -pl 250
but as this seems like to be a service, I bet I have to do some additional “things” and not only create the files in the folders?
One thing I did is to do a chmod 777 nvidia-tdp.service as I saw other services e.g. the display-manager.service has the same attributes / privileges for user/group/others.
And you could add these specific command to the sudoers file to be able to run them without sudo password. It is probably not best secure way to do it but should be simple and work.
sudo visudo
then add at bottom either the line for the whole tool nvidia-smi (so you can sudo the nvidia-smi tool for whatever command without password):
omano ALL=(ALL) NOPASSWD: /usr/bin/nvidia-smi
or add the specific exact commands lines (so you can only sudo without password these commands exactly):
Either way will work, change the user name of course. Save it will warn if you made a mistake, then after that you can reload a new terminal and see you can sudo without password these commands.