gilnobrega / farmr

A web dashboard for monitoring Chia farms. Also supports discord and email notifications.
GNU General Public License v3.0
250 stars 44 forks source link

SystemD Support #34

Open pcfreak30 opened 3 years ago

pcfreak30 commented 3 years ago

For deb/rpm systemd support would be nice.

Here is a starting point:

[Unit]
Description=Chia Farmr Monitor
After=network.target
StartLimitIntervalSec=0
[Service]
User=root
Type=simple
Restart=always
RestartSec=1
ExecStart=/usr/bin/farmr
[Install]
WantedBy=multi-user.target
gilnobrega commented 3 years ago

Hey, this has been in the repo for some days now (https://github.com/joaquimguimaraes/farmr/blob/main/.github/workflows/farmr.service), and it's included as a user service in the .deb, .rpm packages in v1.4.1 I will be writing documentation on how to enable it. systemctl --user enable farmr

babafgd commented 3 years ago

Hi, it seams the service is not installed anymore when doing apt install :(

Feromrk commented 3 years ago

I just installed v1.6.1 on my rpi4 with sudo apt install ./farmr-ubuntu-aarch64.deb and could enable it with systemctl --user enable farmr. Don't forget to start it aswell with systemctl --user start farmr.

Also important: execute sudo loginctl enable-linger $USER once, as the --user flag tells systemd to use user units (which work by default only if the user is logged in). More about it here: https://wiki.ubuntuusers.de/systemd/User_Units/

Knight1 commented 2 years ago

Big Problem is that the farmr service does not wait for the harvester to start and just crashes.

● farmr.service - farmr
     Loaded: loaded (/etc/xdg/systemd/user/farmr.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2021-10-31 00:16:30 UTC; 3h 4min ago
    Process: 1810 ExecStart=/usr/bin/farmr headless (code=exited, status=255/EXCEPTION)
   Main PID: 1810 (code=exited, status=255/EXCEPTION)

Oct 31 00:16:19 chia-farmer systemd[1803]: Started farmr.
Oct 31 00:16:19 chia-farmer farmr[1810]: Unable to detect running chia farming/harvesting service.
Oct 31 00:16:29 chia-farmer farmr[1810]: Unhandled exception:
Oct 31 00:16:29 chia-farmer farmr[1810]: Exception: Unable to detect running chia farming/harvesting service.
Oct 31 00:16:29 chia-farmer farmr[1810]: #0      Blockchain.initializePorts (package:farmr_client/blockchain.dart:211)
Oct 31 00:16:29 chia-farmer farmr[1810]: <asynchronous suspension>
Oct 31 00:16:29 chia-farmer farmr[1810]: #1      main (file:///home/runner/work/farmr/farmr/farmr.dart:167)
Oct 31 00:16:29 chia-farmer farmr[1810]: <asynchronous suspension>
Oct 31 00:16:30 chia-farmer systemd[1803]: farmr.service: Main process exited, code=exited, status=255/EXCEPTION
Oct 31 00:16:30 chia-farmer systemd[1803]: farmr.service: Failed with result 'exit-code'.
gilnobrega commented 2 years ago

Yup I gotta fix that, it didnt happen before thanks for reporting it!