guides:farming:chia_autostart_linux
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
guides:farming:chia_autostart_linux [2021/09/06 11:09] – Typo aj | guides:farming:chia_autostart_linux [2023/08/13 15:43] (current) – old revision restored vleesbanaan | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Chia Autostart (Linux) ====== | ====== 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 | + | 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 |
- | ===== Step 1 - Create | + | ===== Step 1 - Create |
- | Use your prefered editor to create | + | Create |
- | //Note: Replace {USERNAME} | + | //Note: Replace {USERNAME} |
- | //< | + | |
- | # | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | After saving use '' | + | |
- | + | ||
- | ===== Step 2 - Create the Chia service ===== | + | |
- | + | ||
- | Create the Chia service: '' | + | |
- | + | ||
- | //Note: Replace {USERNAME} | + | |
//< | //< | ||
[Unit] | [Unit] | ||
Line 25: | Line 13: | ||
[Service] | [Service] | ||
Type=forking | Type=forking | ||
- | RemainAfterExit=no | + | User={USERNAME} |
- | User=chia | + | WorkingDirectory=/ |
- | WorkingDirectory=/ | + | ExecStart=/usr/bin/bash -c ". ./activate && chia start %i && deactivate" |
- | ExecStart=/home/{username}/startfarm.sh | + | ExecStop=/ |
Restart=always | Restart=always | ||
[Install] | [Install] | ||
WantedBy=multi-user.target | WantedBy=multi-user.target | ||
</ | </ | ||
+ | |||
+ | ===== Step 2 - Reload systemd manager ===== | ||
+ | |||
+ | Reloading the systemd manager is needed to work with our new service. | ||
+ | |||
+ | < | ||
+ | sudo systemctl daemon-reload | ||
+ | </ | ||
+ | |||
+ | ===== Step 3 - Enable the Chia service ===== | ||
+ | |||
+ | The service can take an argument after the ' | ||
+ | |||
+ | For example, to enable the farmer: | ||
+ | |||
+ | < | ||
+ | sudo systemctl enable --now chia@farmer | ||
+ | </ | ||
+ | |||
+ | Running '' | ||
+ | < | ||
+ | $ systemctl status [email protected] | ||
+ | ● [email protected] - Chia Service | ||
+ | | ||
+ | | ||
+ | Process: 13500 ExecStart=/ | ||
+ | Main PID: 13514 (chia_daemon) | ||
+ | Tasks: 17 (limit: 9278) | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Dec 10 21:40:47 chia systemd[1]: Starting Chia Service... | ||
+ | Dec 10 21:40:53 chia bash[13501]: | ||
+ | Dec 10 21:40:53 chia bash[13501]: | ||
+ | Dec 10 21:40:53 chia bash[13501]: | ||
+ | Dec 10 21:40:53 chia bash[13501]: | ||
+ | Dec 10 21:40:53 chia bash[13501]: | ||
+ | Dec 10 21:40:53 chia bash[13501]: | ||
+ | Dec 10 21:40:53 chia systemd[1]: Started Chia Service. | ||
+ | </ | ||
+ | |||
+ | It should say " | ||
+ | |||
+ | From now on, when you reboot the system, Chia should automatically start up. |
guides/farming/chia_autostart_linux.1630926568.txt.gz · Last modified: 2021/09/06 11:09 by aj