-

CommentStreams:83b428d802e65a69d747634d2763f056

From Geekworm Wiki
Jump to navigation Jump to search

Two ways to do this: - Add the following two lines to end (before the exit) of /etc/rc.local

  1. start fan control

python /home/pi/x735-v2.5/pwm_fan_control.py &

- Install it as a systemd service Copy the following text in a file with the name x735-fan.service

==============================

[Unit] Description=x735 Fan control

[Service] User=root WorkingDirectory=/ ExecStart=/home/pi/x735-v2.5/pwm_fan_control.py Restart=always

[Install] WantedBy=multi-user.target

====================================

Copy the file to the directory /usr/lib/systemd/system/ With the command

   systemctl start x735-fan

the service is started. You also have to do the following command that the service is started on a system boot:

   systemctl enable x735-fan

systemd also takes care that the service is restarted if it dies. This also has the advantage, that if you log in multiple times the script is not always started.