add sample config, makefile, service
This commit is contained in:
parent
dff852ce65
commit
15b839d9a7
37
testbot/Makefile
Normal file
37
testbot/Makefile
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
PREFIX?=/usr/local
|
||||||
|
_INSTDIR=$(DESTDIR)$(PREFIX)
|
||||||
|
BINDIR?=$(_INSTDIR)/bin
|
||||||
|
GO?=go
|
||||||
|
GOFLAGS?=
|
||||||
|
|
||||||
|
GOSRC!=find . -name '*.go'
|
||||||
|
GOSRC+=go.mod go.sum
|
||||||
|
RM?=rm -f
|
||||||
|
|
||||||
|
testbot: $(GOSRC)
|
||||||
|
$(GO) build $(GOFLAGS) \
|
||||||
|
-ldflags "-s -w" \
|
||||||
|
-o $@
|
||||||
|
|
||||||
|
all: testbot
|
||||||
|
|
||||||
|
install: all
|
||||||
|
mkdir -m755 -p $(BINDIR) /etc/testbot
|
||||||
|
install -m755 testbot $(BINDIR)/testbot
|
||||||
|
install -m644 config.yaml.sample /etc/testbot/
|
||||||
|
service: all install
|
||||||
|
install -m644 testbot.service /etc/systemd/system/
|
||||||
|
clean:
|
||||||
|
$(RM) testbot
|
||||||
|
RMDIR_IF_EMPTY:=sh -c '\
|
||||||
|
if test -d $$0 && ! ls -1qA $$0 | grep -q . ; then \
|
||||||
|
rmdir $$0; \
|
||||||
|
fi'
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
$(RM) $(BINDIR)/testbot
|
||||||
|
$(RM) /etc/systemd/system/testbot.service
|
||||||
|
${RMDIR_IF_EMPTY} /etc/testbot
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := all
|
||||||
|
.PHONY: all install service uninstall clean
|
9
testbot/config.yaml.sample
Normal file
9
testbot/config.yaml.sample
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
userid: "@testbot:saintnet.tech"
|
||||||
|
server: "matrix.saintnet.tech"
|
||||||
|
token: "token here"
|
||||||
|
name: "TestBot"
|
||||||
|
owner: "@stryan@saintnet.tech"
|
||||||
|
prefix: "!tb"
|
||||||
|
owm_api_key: "OpenWeatherMap API key"
|
||||||
|
lat: "39.004608"
|
||||||
|
long: "-76.875671"
|
13
testbot/testbot.service
Normal file
13
testbot/testbot.service
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Testing Matrix bot
|
||||||
|
After=network.target
|
||||||
|
StartLimitIntervalSec=0
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1
|
||||||
|
User=root
|
||||||
|
ExecStart=/usr/local/bin/testbot
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user