MrBiz / PiFan

Raspberry Pi CPU fan software control for 3 wire or 4 wire fans.
Other
29 stars 5 forks source link

Service exit after start #1

Open ghost opened 5 years ago

ghost commented 5 years ago

Hello,

I always get service active(exited): ● cpufan.service - LSB: CPU fan service Loaded: loaded (/etc/init.d/cpufan; generated; vendor preset: enabled) Active: active (exited) since Wed 2018-10-03 10:57:36 WEST; 16min ago Docs: man:systemd-sysv-generator(8) CGroup: /system.slice/cpufan.service

Any clue?

MrBiz commented 5 years ago

What OS are you running?

Active: active (exited) means that the service is running but the system doesn't understand or can't see the daemon to monitor it (i'm not seeing the same thing on mine). If you run a "sudo service --status-all" you may probably see this "[ - ] cpufan" instead of this "[ + ] cpufan".

If you check the logfile /var/log/cpufan.log it should show when the CPU fan speed was updated, if it's recent then the service is running anyway.

The daemon is located "/var/run/cpufan.pid" see if it is created or not and if it is readable etc?

You also don't have to run the fan as a service you can just run the "fan.py" script at startup in a cron job or from the command line and the fan should start up.

I'm not going to close this issue yet as I will look into writing a unit file for the service that should stop this monitoring quirk.

Thanks for your help :)

Afterschnitzel commented 3 years ago

Same problem here with Raspberry Pi4. /var/log/cpufan.log is empty

pi@raspberry:~ $ sudo service cpufan status
● cpufan.service - LSB: CPU fan service
   Loaded: loaded (/etc/init.d/cpufan; generated)
   Active: active (exited) since Wed 2020-12-02 21:23:11 CET; 36s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 356 ExecStart=/etc/init.d/cpufan start (code=exited, status=0/SUCCESS)

pro 02 21:22:56 raspberry systemd[1]: Starting LSB: CPU fan service...
pro 02 21:22:56 raspberry cpufan[356]: Starting service…
pro 02 21:22:57 raspberry su[362]: (to root) root on none
pro 02 21:22:57 raspberry su[362]: pam_unix(su:session): session opened for user root by (uid=0)
pro 02 21:23:11 raspberry cpufan[356]: Service started
pro 02 21:23:11 raspberry systemd[1]: Started LSB: CPU fan service.
MrBiz commented 3 years ago

I've not had the pleasure of running it on a pi4 yet. Does the fan actually run and vary speed or just full speed or not at all? what happens if you just run fan.py (any errors)?

This may also be as simple as running the service as the "pi" user rather than root due to Raspbian changes with the Root account.

change line 13 in the cpufan file RUNAS=root to RUNAS=pi

and run the commands: sudo systemctl daemon-reload sudo service cpufan start

Afterschnitzel commented 3 years ago

Hi. If i run fan.py, it runs at full speed, but program measure RPM. If I swap cables on pins, it works. But fan RPMs are fluctuating and program does not measure RPM.

And RUNAS=pi does not work for me :-(

MrBiz commented 3 years ago

You are using the transistor as a controller right? Out of curiosity what are the colors of the wires on your fan? Sounds like I may need to get a Pi4.

Afterschnitzel commented 3 years ago

Yes, I am using transistor. And wires are - black, red, yellow - NOCTUA NF-A4x10 5V 3-pin