spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.27k stars 3.04k forks source link

electrum over daemon systemctl #5630

Open badhitman opened 4 years ago

badhitman commented 4 years ago

how to ensure autonomous operation of the wallet? now every time I manually load the wallet after starting the service. I want to configure electrum as daemon. so that it loads automatically when the server restarts. but how? I mean, loading the wallet.

can I immediately specify the location of the wallet? aka:

electrum daemon start --wallet /root/.electrum/wallets/default_wallet

or is there an example script for Units /etc/systemd/system/electrum-daemon-and-autoload-wallet.service

thnx all

badhitman commented 4 years ago

something like that?

[Unit]
Description=Electrum as systemd service

[Service]
ExecStart=electrum daemon start
ExecStartPost=electrum daemon load_wallet -w /root/.electrum/wallets/default_wallet
Restart=always
RestartSec=10 # Перезапускать сервис через 10 секунд при краше приложения
SyslogIdentifier=electrum-example
User=root # пользователь, под которым следует запускать ваш сервис

[Install]
WantedBy=multi-user.target

before loading the wallet need a pause to start daemon?

ecdsa commented 4 years ago

with master you need: electrum daemon --detach you cannot specify the location of the wallet on startup, see #3752

badhitman commented 4 years ago

I'm sorry, I don't understand. yesterday I saw tube top on which you refer. from there I knew how to do. you cannot specify a daemon when you start the path to the wallet?

badhitman commented 4 years ago

it is impossible to specify at once at start in a command line a path to a purse in any way? it's incredible. That's sad. let's assume that the programmer for some reason forbade us to do it at once with one command at daemon start. how can you fool this angry programmer?

SomberNight commented 4 years ago

You know you can just write your own script and wrap two commands, turning it into one?

badhitman commented 4 years ago

is that acceptable?

#!/bin/sh
electrum daemon start
sleep 1;
electrum daemon load_wallet -w /root/.electrum/wallets/default_wallet
done; 
badhitman commented 4 years ago

does anyone have experience using electrum daemon in systemctl? it is enough to specify

[Unit]
Description=Electrum as systemd service

[Service]
ExecStart=/root/smart_start_electrum.sh
Restart=always
RestartSec=10
SyslogIdentifier=electrum-example
User=root

[Install]
WantedBy=multi-user.target

and in the script smart_start_electrum.sh file for example to specify so:

#!/bin/sh
/root/Electrum-3.3.8/run_electrum daemon start
sleep 1;
/root/Electrum-3.3.8/run_electrum daemon load_wallet -w /root/.electrum/wallets/default_wallet
done; 

is this supposed to work fine?

ecdsa commented 4 years ago

there is no guarantee that sleeping one second will be enough, although it should work fine in most cases

arcaela commented 4 years ago

!/bin/sh

/root/Electrum-3.3.8/run_electrum daemon start --wallet /root/.electrum/wallets/default_wallet sleep 1; /root/Electrum-3.3.8/run_electrum daemon load_wallet done;