Add systemd timer/service + update readme

This commit is contained in:
idanoo 2023-01-30 13:04:12 +13:00
parent 98c957b755
commit f1066d74d7
Signed by: idanoo
GPG key ID: 387387CDBC02F132
3 changed files with 30 additions and 1 deletions

View file

@ -1,5 +1,12 @@
Create readonly account with access to stats DB
# go-mastodon-stats
Pulls in a bunch of stats from services, sends to a statsdb schema and posts to matrix/mastodon weekly.
Setup a new application, use the ID/SECRET in your .env with some user creds
> https://mastodon.nz/settings/applications/new
Create readonly account with access to stats DB
```
CREATE USER gomastodonstats WITH PASSWORD 'superrandompassword';

12
dist/stats.service vendored Normal file
View file

@ -0,0 +1,12 @@
[Unit]
Description=Add stats to mastodon/etc
Wants=stats.timer
[Service]
Type=oneshot
User=root
WorkingDirectory=/root/go-mastodon-stats
ExecStart=/usr/local/go/bin/go run cmd/gomastodonstats/main.go
[Install]
WantedBy=multi-user.target

10
dist/stats.timer vendored Normal file
View file

@ -0,0 +1,10 @@
[Unit]
Description=Run stats on Monday
Requires=stats.service
[Timer]
Unit=stats.service
OnCalendar=Weekly Pacific/Auckland
[Install]
WantedBy=timers.target