From 7f0eedfed5618fb792b163d209d5bd7f8c201aa0 Mon Sep 17 00:00:00 2001 From: gStart9 Date: Thu, 10 Oct 2024 15:06:05 -0600 Subject: [PATCH] Fixup monero-wallet-rpc awaiting wallet files --- utils/config/monero-wallet-rpc.btcpayserver.conf.template | 8 ++++---- utils/s6-overlay/services/monero-wallet-rpc/run | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/utils/config/monero-wallet-rpc.btcpayserver.conf.template b/utils/config/monero-wallet-rpc.btcpayserver.conf.template index 2292bb5..f1704b9 100644 --- a/utils/config/monero-wallet-rpc.btcpayserver.conf.template +++ b/utils/config/monero-wallet-rpc.btcpayserver.conf.template @@ -8,10 +8,10 @@ daemon-host=monerod.embassy daemon-port=18089 disable-rpc-login=1 -wallet-dir=MONERO_BTCPAY_WALLET_DIR -#wallet-file=MONERO_BTCPAY_WALLET_DIR/wallet -#password-file=MONERO_BTCPAY_WALLET_DIR/password -log-file=logs/monero-wallet-rpc.btcpayserver.log +#wallet-dir=MONERO_BTCPAY_WALLET_DIR +wallet-file=MONERO_BTCPAY_WALLET_DIR/wallet +password-file=MONERO_BTCPAY_WALLET_DIR/password +log-file=MONERO_DIR/logs/monero-wallet-rpc.btcpayserver.log #log-level=2 max-log-file-size=10000000 #10MiB max-log-files=2 diff --git a/utils/s6-overlay/services/monero-wallet-rpc/run b/utils/s6-overlay/services/monero-wallet-rpc/run index ac96a57..5428ee2 100644 --- a/utils/s6-overlay/services/monero-wallet-rpc/run +++ b/utils/s6-overlay/services/monero-wallet-rpc/run @@ -7,7 +7,7 @@ set -ea # check readiness of altcoin connections if configured to use monero_status=$(yq e '.altcoins.monero.status' /datadir/start9/config.yaml) -if [[ $monero_status = "enabled" ]] +if [[ $monero_status = "enabled" ]] then MONERO_DIR=/datadir/btcpayserver/altcoins/monero mkdir -p $MONERO_DIR @@ -48,6 +48,12 @@ then sed -i "s|MONERO_BTCPAY_WALLET_DIR|$MONERO_BTCPAY_WALLET_DIR|g" $MONERO_BTCPAY_WALLET_RPC_CONF && \ sed -i "s|MONERO_DAEMON_RPC_CREDENTIALS|$monero_daemon_rpc_credentials|g" $MONERO_BTCPAY_WALLET_RPC_CONF + #Delay and try again if the wallet file is not already in place... + while [[ ! -f "$MONERO_BTCPAY_WALLET_DIR/wallet" || ! -f "$MONERO_BTCPAY_WALLET_DIR/password" ]] + do + #Check again soon to see if the wallet file has been uploaded + sleep 3 + done # start monero-wallet-rpc, copying stderr onto stdout exec s6-setuidgid $MONERO_UID:$MONERO_GID /usr/local/bin/monero-wallet-rpc --non-interactive --config-file $MONERO_BTCPAY_WALLET_RPC_CONF 2>&1