2.0 KiB
Linux startup services
Setting up startup services
Caution
You should secure the files under an admin only folder, so only authorized programs can modify the scripts (and DON'T use SUID on Linux with this program)
This section will present some simple commands to setup services that start as root and run the program with the configured settings.
Systemd service
The next steps will show how to install a global (system wide) systemd service and enable it. Such steps were only tested on a Ubuntu machine.
-
Take a look at the systemd service at
linux_config/caioh-gpu-nvml-control.service. Change the GPU name and the settings to the desired configuration at the ExecStart. -
Copy the unit file into
/etc/systemd/system/(needs root)
sudo cp ./linux_config/caioh-gpu-nvml-control.service /etc/systemd/system/
- Enable the service (needs root)
sudo systemctl enable --now caioh-gpu-nvml-control.service
- Troubleshoot if needed (get the stdout from the service)
sudo journalctl -u caioh-gpu-nvml-control.service
Restart the service
sudo systemctl restart caioh-gpu-nvml-control.service
Reload the service
sudo systemctl reload caioh-gpu-nvml-control.service
Reload systemd daemon
sudo systemctl daemon-reload
To remove the service, you only need to delete the file
sudo rm -i /etc/systemd/system/caioh-gpu-nvml-control.service
Crontab (contributed by user on Reddit: Brockar / @brockar)
- Edit root's crontab (this ensures that the command will run as root)
sudo crontab -e
- Add the command (make the changes you want here)
@reboot chnvml -n "GPU_NAME" -pl 290 -tl 65 -sp "0:50,36:55,40:75,45:100"