Adding systemd service and timer for prober

This commit is contained in:
ditatompel 2024-05-06 21:45:33 +07:00
parent 0804c4f055
commit 899ffd0830
No known key found for this signature in database
GPG key ID: 31D3D06D77950979
3 changed files with 40 additions and 0 deletions

View file

@ -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-<YOUR_CPU_ARCH> serve`.
To create admin user (for creating prober API key from Web-UI, execute `./bin/xmr-nodes-static-linux-<YOUR_CPU_ARCH> 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-<YOUR_CPU_ARCH> 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).

View file

@ -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

View file

@ -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