mirror of
https://github.com/mynodebtc/mynode.git
synced 2025-01-11 11:29:27 +00:00
Improved shutdown / reboot consistency
This commit is contained in:
parent
c4290a4849
commit
028ebba09c
|
@ -6,6 +6,7 @@ Description=Bitcoin daemon
|
|||
After=network.target mynode.service
|
||||
|
||||
[Service]
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStartPre=/usr/bin/wait_on_uploader.sh
|
||||
ExecStartPre=/bin/sh -c 'cat /mnt/hdd/mynode/quicksync/.quicksync_complete'
|
||||
EnvironmentFile=/mnt/hdd/mynode/bitcoin/env
|
||||
|
|
|
@ -7,6 +7,7 @@ Wants=bitcoind.service
|
|||
After=bitcoind.service
|
||||
|
||||
[Service]
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStartPre=/usr/bin/wait_on_bitcoin.sh
|
||||
ExecStartPre=/usr/bin/wait_on_electrs.sh
|
||||
WorkingDirectory=/opt/mynode/btc-rpc-explorer
|
||||
|
|
|
@ -9,6 +9,7 @@ Requires=docker.service network-online.target bitcoind.service
|
|||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStart=/bin/bash -c '. "/opt/mynode/btcpayserver/btcpay-env.sh" && cd "$BTCPAY_BASE_DIRECTORY" && . helpers.sh && btcpay_up'
|
||||
ExecStop=/bin/bash -c '. "/opt/mynode/btcpayserver/btcpay-env.sh" && cd "$BTCPAY_BASE_DIRECTORY" && . helpers.sh && btcpay_down'
|
||||
ExecReload=/bin/bash -c '. "/opt/mynode/btcpayserver/btcpay-env.sh" && cd "$BTCPAY_BASE_DIRECTORY" && . helpers.sh && btcpay_restart'
|
||||
|
|
|
@ -9,6 +9,7 @@ After=mynode.service
|
|||
[Service]
|
||||
Type=simple
|
||||
KillMode=control-group
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStart=/usr/bin/mynode_docker_images.sh
|
||||
User=root
|
||||
Group=root
|
||||
|
|
|
@ -8,6 +8,7 @@ After=network.target mynode.service docker_images.service
|
|||
[Service]
|
||||
Type=forking
|
||||
RemainAfterExit=yes
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStartPre=/usr/bin/wait_on_bitcoin.sh
|
||||
ExecStartPre=/usr/bin/wait_on_docker_image_install.sh
|
||||
WorkingDirectory=/opt/mynode/dojo/docker/my-dojo
|
||||
|
|
|
@ -10,6 +10,7 @@ After=bitcoind.service
|
|||
Type=simple
|
||||
KillMode=process
|
||||
EnvironmentFile=/mnt/hdd/mynode/settings/.btcrpc_environment
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStartPre=/usr/bin/wait_on_bitcoin.sh
|
||||
ExecStart=/usr/bin/electrs --timestamp --db-dir /mnt/hdd/mynode/electrs --electrum-rpc-addr 0.0.0.0:50001 --cookie="mynode:${BTC_RPC_PASSWORD}" --jsonrpc-import --bulk-index-threads 3 --index-batch-size 12 --daemon-rpc-addr 127.0.0.1:8332 --txid-limit 100 --tx-cache-size 10000 -vvvv
|
||||
User=bitcoin
|
||||
|
|
|
@ -6,6 +6,7 @@ Description=Glances
|
|||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStart=/usr/bin/glances -w
|
||||
User=root
|
||||
Group=root
|
||||
|
|
|
@ -7,6 +7,7 @@ Wants=bitcoind.service
|
|||
After=bitcoind.service
|
||||
|
||||
[Service]
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStartPre=/usr/bin/pre_lnd.sh
|
||||
ExecStartPre=/usr/bin/wait_on_bitcoin.sh
|
||||
ExecStart=/usr/local/bin/lnd --caches.channel-cache-size=35000 --ignore-historical-gossip-filters --accept-keysend
|
||||
|
|
|
@ -7,6 +7,7 @@ Wants=lnd.service
|
|||
After=lnd.service
|
||||
|
||||
[Service]
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStartPre=/usr/bin/wait_on_lnd.sh
|
||||
Environment=PORT=3000
|
||||
WorkingDirectory=/opt/mynode/LndHub
|
||||
|
|
|
@ -8,6 +8,7 @@ After=www.service docker_images.service
|
|||
|
||||
[Service]
|
||||
EnvironmentFile=/mnt/hdd/mynode/settings/.btcrpc_environment
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStartPre=/usr/bin/wait_on_bitcoin.sh
|
||||
ExecStartPre=/usr/bin/wait_on_docker_image_install.sh
|
||||
ExecStart=/usr/bin/docker run --rm --name mempoolspace -p 4080:80 -e BITCOIN_NODE_HOST=172.17.0.1 -e BITCOIN_NODE_USER=mynode -e BITCOIN_NODE_PASS=${BTC_RPC_PASSWORD} -e MEMPOOL_REFRESH_RATE_MS=10000 mempoolspace
|
||||
|
|
|
@ -8,6 +8,7 @@ After=mynode.service docker_images.service
|
|||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/mynode/netdata
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStartPre=/usr/bin/wait_on_bitcoin.sh
|
||||
ExecStart=/usr/local/bin/docker-compose -f netdata-compose.yml up
|
||||
ExecStop=/usr/local/bin/docker-compose -f netdata-compose.yml down
|
||||
|
|
|
@ -13,6 +13,7 @@ TimeoutSec=60
|
|||
Restart=always
|
||||
RestartSec=30
|
||||
Nice=5
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStart=/usr/bin/mynode_quicksync.sh
|
||||
User=bitcoin
|
||||
Group=bitcoin
|
||||
|
|
|
@ -7,6 +7,7 @@ Wants=bitcoind.service
|
|||
After=bitcoind.service
|
||||
|
||||
[Service]
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStartPre=/usr/bin/wait_on_lnd.sh
|
||||
WorkingDirectory=/opt/mynode/RTL
|
||||
ExecStart=/usr/bin/node rtl
|
||||
|
|
|
@ -7,6 +7,7 @@ Wants=www.service docker_images.service
|
|||
After=www.service docker_images.service
|
||||
|
||||
[Service]
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStart=/usr/bin/docker run --rm --name webssh2 -p 2222:2222 -v /opt/mynode/webssh2/config.json:/usr/src/config.json webssh2
|
||||
ExecStop=/usr/bin/docker stop -t 2 webssh2
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ After=tor.service
|
|||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/mynode/whirlpool
|
||||
ExecStartPre=/usr/bin/is_not_shutting_down.sh
|
||||
ExecStart=/usr/bin/java -jar /opt/mynode/whirlpool/whirlpool.jar --server=mainnet --tor --auto-mix --mixs-target=3 --listen
|
||||
User=bitcoin
|
||||
Group=bitcoin
|
||||
|
|
12
rootfs/standard/usr/bin/is_not_shutting_down.sh
Executable file
12
rootfs/standard/usr/bin/is_not_shutting_down.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Wait to see if bitcoind is synced
|
||||
echo "Checking if device is shutting down..."
|
||||
if [ ! -f "/tmp/shutting_down" ]; then
|
||||
echo "Not shutting down!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Device is shutting down... delay and exit failure"
|
||||
sleep 30s
|
||||
exit 1
|
|
@ -440,6 +440,8 @@ fi
|
|||
|
||||
|
||||
# Enable any new/required services
|
||||
systemctl enable bitcoind
|
||||
systemctl enable lnd
|
||||
systemctl enable firewall
|
||||
systemctl enable invalid_block_check
|
||||
systemctl enable usb_driver_check
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Mark we are shutting down
|
||||
touch /tmp/shutting_down
|
||||
|
||||
|
||||
# Stop additional services
|
||||
systemctl stop glances
|
||||
systemctl stop lndhub
|
||||
systemctl stop netdata
|
||||
systemctl stop glances
|
||||
systemctl stop rtl
|
||||
systemctl stop webssh2
|
||||
systemctl stop whirlpool
|
||||
|
|
Loading…
Reference in New Issue
Block a user