I wouldn't leave this on once you've confirmed that it's all working though as this would perform unnecessary writes to your SD card. If you want to see what is happening, set DEBUG=1 and information will be written to /tmp/debug. Modify the variables at the beginning of the script to your liking. You can create a new bash script with the following content. Now we have the program we'll use to control the fan via PWM.
#Retropie overlays install
Build and install: make & sudo make install.Decompress: unzip pigpio.zip & cd PIGPIO.
Let me begin by saying I'm not an electrical engineer.