Mercurial Hosting > luan
comparison host/admin/src/private/lib/monitor_lucene_backups.luan @ 2022:969291201e12
ping lucene backups
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 20 Oct 2025 17:25:47 -0600 |
parents | |
children | 544ccce564f6 |
comparison
equal
deleted
inserted
replaced
2021:b8e5d53c4fc9 | 2022:969291201e12 |
---|---|
1 local Luan = require "luan:Luan.luan" | |
2 local error = Luan.error | |
3 local Time = require "luan:Time.luan" | |
4 local Thread = require "luan:Thread.luan" | |
5 local Lucene = require "luan:lucene/Lucene.luan" | |
6 local ping_backups = Lucene.ping_backups or error() | |
7 local Utils = require "site:/private/lib/Utils.luan" | |
8 local send_mail = Utils.send_mail or error() | |
9 local Logging = require "luan:logging/Logging.luan" | |
10 local logger = Logging.logger "monitor_lucene_backups" | |
11 | |
12 | |
13 local function check() | |
14 local backup_domain = ping_backups() | |
15 if backup_domain == nil then | |
16 logger.info("lucene backups are okay") | |
17 else | |
18 local msg = "lucene backups to "..backup_domain.." aren't working" | |
19 logger.error(msg) | |
20 send_mail { | |
21 Subject = "lucene backups" | |
22 body = msg | |
23 } | |
24 end | |
25 end | |
26 | |
27 Thread.schedule(check,{repeating_delay=Time.period{hours=1}}) | |
28 check() | |
29 | |
30 return true |