diff --git a/docs/setup/asb/systemd/pull-and-build-asb.service b/docs/setup/asb/systemd/pull-and-build-asb.service index 861daf77..63a316d1 100644 --- a/docs/setup/asb/systemd/pull-and-build-asb.service +++ b/docs/setup/asb/systemd/pull-and-build-asb.service @@ -1,13 +1,13 @@ [Unit] Description=Pull and build ASB from source Wants=pull-and-build-asb.timer +OnFailure=unit-status-email@%n.service [Service] Type=oneshot WorkingDirectory=/var/external/asb/xmr-btc-swap ExecStartPre=git pull ExecStart=/home/asb/.cargo/bin/cargo build --release --bin asb -ExecStopPost=/bin/sh -c 'if [ "$$EXIT_STATUS" -ne 0 ]; then /usr/local/bin/systemd-email.sh daniel@coblox.tech %n; fi' StandardOutput=append:/var/external/asb/run/logs/pull-and-build.log StandardError=append:/var/external/asb/run/logs/pull-and-build.log User=asb diff --git a/docs/setup/asb/systemd/restart-asb.service b/docs/setup/asb/systemd/restart-asb.service index 95f93d9d..0422fd5e 100644 --- a/docs/setup/asb/systemd/restart-asb.service +++ b/docs/setup/asb/systemd/restart-asb.service @@ -1,11 +1,11 @@ [Unit] Description=Restart ASB service After=watch-asb-binary-change.path +OnFailure=unit-status-email@%n.service [Service] Type=oneshot ExecStart=/usr/bin/systemctl restart start-asb.service -ExecStopPost=/bin/sh -c 'if [ "$$EXIT_STATUS" -ne 0 ]; then /usr/local/bin/systemd-email.sh daniel@coblox.tech %n; fi' [Install] WantedBy=multi-user.target diff --git a/docs/setup/asb/systemd/start-asb.service b/docs/setup/asb/systemd/start-asb.service index 349ee86d..9b36c400 100644 --- a/docs/setup/asb/systemd/start-asb.service +++ b/docs/setup/asb/systemd/start-asb.service @@ -1,11 +1,11 @@ [Unit] Description=Run the automated swap backend After=start-monero-wallet-rpc.service +OnFailure=unit-status-email@%n.service [Service] WorkingDirectory=/var/external/asb/xmr-btc-swap ExecStart=/home/asb/.cargo/bin/cargo run --release --bin asb -- --config /var/external/asb/run/asb-config/config.toml start -ExecStopPost=/bin/sh -c 'if [ "$$EXIT_STATUS" -ne 0 ]; then /usr/local/bin/systemd-email.sh daniel@coblox.tech %n; fi' StandardOutput=append:/var/external/asb/run/logs/start-asb.log StandardError=append:/var/external/asb/run/logs/start-asb.log Restart=on-failure diff --git a/docs/setup/asb/systemd/start-monero-wallet-rpc.service b/docs/setup/asb/systemd/start-monero-wallet-rpc.service index d78e732a..48fa735e 100644 --- a/docs/setup/asb/systemd/start-monero-wallet-rpc.service +++ b/docs/setup/asb/systemd/start-monero-wallet-rpc.service @@ -1,11 +1,11 @@ [Unit] Description=monero-wallet-rpc for the automated swap backend (asb) After=network.target +OnFailure=unit-status-email@%n.service [Service] ExecStart=/var/external/asb/monero/bin/monero-wallet-rpc --stagenet --daemon-host stagenet.community.xmr.to --rpc-bind-port 38083 --disable-rpc-login --wallet-dir /var/external/asb/monero/data/stagenet/asb-wallets -ExecStartPost=/bin/bash -c "i=1; while [ $i -ne 0 ]; do tail -n1 /var/external/asb/monero/bin/monero-wallet-rpc.log | grep 'Starting wallet RPC server'; i=$?; sleep 5; done" -ExecStopPost=/bin/sh -c 'if [ "$$EXIT_STATUS" -ne 0 ]; then /usr/local/bin/systemd-email.sh daniel@coblox.tech %n; fi' +ExecStartPost=/usr/bin/bash -c "i=1; while [ $i -ne 0 ]; do tail -n1 /var/external/asb/monero/bin/monero-wallet-rpc.log | grep 'Starting wallet RPC server'; i=$?; sleep 5; done" Restart=always User=asb Group=asb diff --git a/docs/setup/asb/systemd/unit-status-email@.service b/docs/setup/asb/systemd/unit-status-email@.service new file mode 100644 index 00000000..9c75ebd9 --- /dev/null +++ b/docs/setup/asb/systemd/unit-status-email@.service @@ -0,0 +1,6 @@ +[Unit] +Description=%i email notification + +[Service] +Type=oneshot +ExecStart=/usr/bin/bash -c '/usr/local/bin/systemd-email.sh daniel@coblox.tech %i'