Clone with
git clone git://git.awl.red/neallred/qanda
qanda📎
Q and A.
Service for recording answers to repeated questions. Can optionally notify a command of the response to the question.
E.g.
- What is my external facing IP?
- How much disk space am I using?
Specify questions in json file
Questions receive no arguments, and are expected to output a string value of 1024 characters or less.
Responses receive the name of the question, the Unix timestamp, the old value, and the new value.
[
{
"name": "ip_addr",
"frequency": 300,
"delay": 3,
"question": "check_ip.sh",
"record": "on_change",
"response": "warn_ip_change.sh",
"response_when": "on_change",
"max_history": 100
}
]
Local dev📎
CGO_ENABLED=1 go run main.go --dbname "/tmp/sqlite-qanda" --questions ~/qanda.json
You may not want to use the in-memory database, even for testing/local dev. It isn't suitable for concurrent write access without extra pragmas set.
Library considerations📎
Doing as much as possible with no added libs. Looked at https://modernc.org/sqlite , but it errors on concurrent writes, and isn't as heavily used as sqlite. mattn/go-sqlite3 also has no other deps.