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 12:02] – [Step 3 - Enable the Chia service] gnomuz | guides:farming:chia_autostart_linux [2023/08/13 15:43] (current) – old revision restored vleesbanaan | ||
---|---|---|---|
Line 3: | Line 3: | ||
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 only the node or harvester (change the startup script accordingly). | 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 only the node or harvester (change the startup script accordingly). | ||
- | ===== Step 1 - Create | + | ===== Step 1 - Create |
- | Use your preferred editor to create | + | Create |
- | //Note: Replace {USERNAME} with the name of the user having Chia installed. | + | //Note: Replace {USERNAME} (2x) with the name of the user having Chia installed. |
- | //< | + | |
- | # | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | After saving use '' | + | |
- | + | ||
- | ===== Step 2 - Create the Chia service ===== | + | |
- | + | ||
- | Create the Chia service: '' | + | |
- | + | ||
- | //Note: Replace {USERNAME} (3x) with the name of the user having Chia installed. | + | |
//< | //< | ||
[Unit] | [Unit] | ||
Line 25: | Line 13: | ||
[Service] | [Service] | ||
Type=forking | Type=forking | ||
- | RemainAfterExit=no | + | User={USERNAME} |
- | User={username} | + | WorkingDirectory=/ |
- | WorkingDirectory=/ | + | ExecStart=/usr/bin/bash -c ". ./activate && chia start %i && deactivate" |
- | ExecStart=/home/{username}/startchia.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 ===== | ===== Step 3 - Enable the Chia service ===== | ||
- | You should now be able to see the service | + | The service |
+ | |||
+ | For example, to enable the farmer: | ||
< | < | ||
- | $ sudo systemctl | + | sudo systemctl |
- | ● chia.service | + | |
- | | + | |
- | | + | |
</ | </ | ||
- | * Enable the service by running: '' | + | Running '' |
- | * Start the service by running: '' | + | |
- | + | ||
- | Running '' | + | |
< | < | ||
- | $ sudo systemctl status chia | + | $ systemctl status chia@farmer.service |
- | ● chia.service - Chia Service | + | ● chia@farmer.service - Chia Service |
- | | + | |
- | | + | |
- | Process: | + | Process: |
- | Main PID: 503 (chia_daemon) | + | |
- | Tasks: | + | Tasks: |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | ├─ 711 chia_wallet | + | └─13523 chia_wallet |
- | | + | |
- | | + | |
- | Sep 06 13:41:37 debian | + | Dec 10 21:40:47 chia systemd[1]: Starting Chia Service... |
- | Sep 06 13:41:42 debian startfarm.sh[492]: Daemon not started yet | + | Dec 10 21:40:53 chia bash[13501]: Daemon not started yet |
- | Sep 06 13:41:42 debian startfarm.sh[492]: Starting daemon | + | Dec 10 21:40:53 chia bash[13501]: Starting daemon |
- | Sep 06 13:41:42 debian startfarm.sh[492]: chia_harvester: | + | Dec 10 21:40:53 chia bash[13501]: chia_harvester: |
- | Sep 06 13:41:42 debian startfarm.sh[492]: chia_farmer: | + | Dec 10 21:40:53 chia bash[13501]: chia_farmer: |
- | Sep 06 13:41:42 debian startfarm.sh[492]: chia_full_node: | + | Dec 10 21:40:53 chia bash[13501]: chia_full_node: |
- | Sep 06 13:41:42 debian startfarm.sh[492]: chia_wallet: | + | Dec 10 21:40:53 chia bash[13501]: chia_wallet: |
- | Sep 06 13:41:42 debian | + | Dec 10 21:40:53 chia systemd[1]: Started Chia Service. |
</ | </ | ||
guides/farming/chia_autostart_linux.1630929740.txt.gz · Last modified: 2021/09/06 12:02 by gnomuz