This is an old revision of the document!
Table of Contents
Chia Autostart (Linux)
Running Chia as a service has several benefits, the main one being this always ensures your node / farm is running. Example given: When your farm reboots unexpectedly the service will auto start your farm after boot. You can also use this to autostart your node or harvester (change the startup script accordingly).
Step 1 - Create a Chia startup script
Use your prefered editor to create the following text file and save it (eg: startfarm.sh)
Note: Replace {USERNAME} with the name of the user having Chia installed.
#!/bin/bash /usr/bin/env bash -c 'cd /home/{USERNAME}/chia-blockchain && . ./activate && chia start farmer' 2>/dev/null
After saving use chmod +x startfarm.sh
to set the correct permissions. You can now execute the script to test if this starts up your farm: ./startfarm.sh
.
Step 2 - Create the Chia service
Create the Chia service: nano /etc/systemd/system/chia.service
and paste the following service:
Note: Replace {USERNAME} with the name of the user having Chia installed.
[Unit] Description=Chia Service [Service] Type=forking RemainAfterExit=no User=chia WorkingDirectory=/home/{username}/chia-blockchain ExecStart=/home/{username}/startfarm.sh Restart=always [Install] WantedBy=multi-user.target