Raspberry PI - Fan Controller part 3
Be cool Part 4 - setting up a cron job and shell command script
This script will make the Pi load and execute our fanControl script automatically at startup every time. To make the fancontrol.py program run at startup the first thing that we need to do is to create a shell script.
You can also download this from Dropbox
#!/bin/sh
# copy this file to /scripts
cd /
cd home/pi/scripts
sudo python fanControl.py
cd ~
# copy this file to /scripts
cd /
cd home/pi/scripts
sudo python fanControl.py
cd ~
do this by typing into the terminal screen -
(if you do not have nano you can use another editor, or use sudo apt-get install nano to get it)
go to our /scripts folder
cd /scripts
sudo nano launcher.sh
now we need to make the shell script executable
sudo
sudo chmod +x launcher.sh
they are the same in function.
Test the script
sudo sh launcher.sh
the fan should run for 5 seconds, or longer of the CPU is hot
use 'ctrl' + c to exit it
Make a cron job for itthis will make it run at startup
cd ~
mkdir logs
sudo crontab -e
in the cron program type
and reboot
sudo reboot
If the fan does not run for 5 seconds at boot up, type
cat cronlog
from a terminal and read the log.
Good luck!
Comments
Post a Comment