From 899ffd0830d0173fe8a454e827c3fab71ecdbc61 Mon Sep 17 00:00:00 2001 From: ditatompel Date: Mon, 6 May 2024 21:45:33 +0700 Subject: [PATCH] Adding systemd service and timer for prober --- README.md | 12 ++++++++++++ tools/resources/init/xmr-nodes-prober.service | 12 ++++++++++++ tools/resources/init/xmr-nodes-prober.timer | 16 ++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 tools/resources/init/xmr-nodes-prober.service create mode 100644 tools/resources/init/xmr-nodes-prober.timer diff --git a/README.md b/README.md index e20b022..d19573b 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,16 @@ For initial server setup: 4. Build the binary with `make build`. 5. Run the service with `./bin/xmr-nodes-static-linux- serve`. +To create admin user (for creating prober API key from Web-UI, execute `./bin/xmr-nodes-static-linux- admin create`). + Systemd example: [./tools/resources/init/xmr-nodes-server.service](./tools/resources/init/xmr-nodes-server.service). + +For initial prober setup: + +1. Create API key for prober +2. Copy `.env.example` to `.env` and edit it to match with prober environment. +3. Build the binary with `make build`. +4. Run the service with `./bin/xmr-nodes-static-linux- prober`. + +Systemd example: [xmr-nodes-prober.service](./tools/resources/init/xmr-nodes-prober.service) and [xmr-nodes-prober.timer](./tools/resources/init/xmr-nodes-prober.timer). + diff --git a/tools/resources/init/xmr-nodes-prober.service b/tools/resources/init/xmr-nodes-prober.service new file mode 100644 index 0000000..608484e --- /dev/null +++ b/tools/resources/init/xmr-nodes-prober.service @@ -0,0 +1,12 @@ +[Unit] +Description=xmr-node prober service +After=network.target + +[Service] +Type=oneshot +User=ditatompel +WorkingDirectory=/path/to/project/dir +ExecStart=/path/to/project/dir/bin/xmr-nodes-static-linux-arm64 probe +TimeoutSec=90 + +# vim: filetype=systemd diff --git a/tools/resources/init/xmr-nodes-prober.timer b/tools/resources/init/xmr-nodes-prober.timer new file mode 100644 index 0000000..91b66bd --- /dev/null +++ b/tools/resources/init/xmr-nodes-prober.timer @@ -0,0 +1,16 @@ +[Unit] +Description=Schedule fetch monero node info every 30 seconds + +[Timer] +Persistent=true +#Run 120 seconds after boot for the first time +OnBootSec=120 +#Run every 30 seconds thereafter +OnCalendar=*-*-* *:*:00,30 +#File describing job to execute +Unit=xmr-nodes-prober.service + +[Install] +WantedBy=timers.target + +# vim: filetype=systemd