- Put 'nvload.service' into /etc/systemd/system
- chmod 664 nvload.service
- Put 'nvsmi-load.sh' script in e.g. /usr/local/nvsmi-load.sh
- chmod 744 nvsmi-load.sh
- Optionally correct path to the nvsmi-load.sh From root exec cmds:
- 'systemctl daemon-reload'
- 'systemctl enable nvload.service'
- To test if works exec: systemctl start nvload.service
- Check if /tmp/nvsmi-load.log exists and have expected contetn (output of nvidia-smi and if have current date & time at header).
Created
January 8, 2018 17:26
-
-
Save saper-2/1c7711720b358fe1dc519b6ec5e351c8 to your computer and use it in GitHub Desktop.
Debian 9 nvidia-smi at boot from systemd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Load nvidia-smi to prevent overheating GPU | |
[Service] | |
ExecStart=/usr/local/nvsmi-load.sh | |
[Install] | |
WantedBy=multi-user.target | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo -e "\n\nExecuting nvidia-smi..." | |
/usr/bin/nvidia-smi 1>/tmp/nvsmi-load.log | |
SMI_RESULT=$? | |
echo -e "\n" | |
if [ $SMI_RESULT -eq 0 ]; then | |
echo -e "\e[32mnvidia-smi: EXEC OK!\e[93m\n" | |
cat /tmp/nvsmi-load.log | |
echo -e "\e[0m\n\n" | |
else | |
echo -e "\e[91mERROR: $SMI_RESULT\e[0m\n\n" | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment