Added systemd deamon.

This commit is contained in:
Domen Tabernik 2019-03-08 19:52:00 +00:00
parent 239061852c
commit 2947867f8c
2 changed files with 50 additions and 2 deletions

View File

@ -4,7 +4,7 @@ This controller enables automatic adjustments of FANs in SUPERMICRO servers base
# Requirements
* Linux (tested on Ubuntu 16.04)
* Linux (tested on Ubuntu 18.04)
* Python 2.7
* nvidia drivers/tools (`nvidia-smi`)
* IPMI tool (`impitool`) with loaded module (`modprobe ipmi_devintf`)
@ -13,7 +13,26 @@ Tested on SUPERMICRO 4029GP TRT2 with RTX 2080 Ti (nvidia 415.27 drivers).
# Usage
Directly call python script (requires sudo access for `impitool`):
```bash
python superfans_gpu_controller.py
sudo python superfans_gpu_controller.py
```
Or install systemd service (`superfans-gpu-controller.service`):
```bash
sudo chmod +x ./install_deamon.sh
sudo ./install_deamon.sh
```
Service is registered for start at system startup. Start and stop it using:
```bash
# start
sudo systemctl start superfans-gpu-controller
# stop
sudo systemctl stop superfans-gpu-controller
# check the status
sudo systemctl status superfans-gpu-controller
```

29
install_deamon.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
echo "Created '/etc/systemd/system/superfans-gpu-controller.service' service file"
echo "[Unit]
Description=GPU-based controller of SUPERMICRO server FANs
After=syslog.target
[Service]
Type=simple
User=root
Group=root
WorkingDirectory=`pwd`
ExecStart=python `pwd`/superfans_gpu_controller.py
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=multi-user.target" > /etc/systemd/system/superfans-gpu-controller.service
echo "\n"
echo "Registering superfans-gpu-controller.service"
systemctl enable superfans-gpu-controller.service
systemctl daemon-reload
echo "Enabled start at system startup"
systemctl enable myservice
echo "Starting the service"
systemctl start superfans-gpu-controller