Skip to content

Instantly share code, notes, and snippets.

@TimoPtr
Created April 24, 2021 16:24
Show Gist options
  • Save TimoPtr/2a938a4a54e62cc7766bfe61e3051f96 to your computer and use it in GitHub Desktop.
Save TimoPtr/2a938a4a54e62cc7766bfe61e3051f96 to your computer and use it in GitHub Desktop.
Chia service
[Unit]
Description=Chia Daemon
After=network-online.target multi-user.target
Requires=network-online.target
[Service]
Type=forking
TimeoutStartSec=infinity
User=chia
ExecStart=/bin/bash /home/chia/start_chia.sh
ExecStop=/bin/bash /home/chia/stop_chia.sh
[Install]
WantedBy=multi-user.target
#!/bin/bash
cd /home/chia/chia-blockchain
. ./activate
chia start farmer -r
echo "chia started"
#!/bin/bash
cd /home/chia/chia-blockchain
. ./activate
chia stop -d all
echo "chia stoped"
@TimoPtr
Copy link
Author

TimoPtr commented Apr 24, 2021

In this scripts I assume the blockchain source is in /home/chia/chia-blockain and there is a user chia in the system.

  1. Put the service file in /etc/systemd/system/ or create a link
  2. Put the start and stop in /home/chia
  3. Enable the service sudo systemctl enable chia.service

To check the status systemctl status chia

@SavageCore
Copy link

Thanks for this!

Your 2 commands above are wrong, they should be systemctl not servicectl

@TimoPtr
Copy link
Author

TimoPtr commented May 22, 2021

True I did wrote it too fast 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment