diff options
| author | 2026-04-24 01:33:23 +0000 | |
|---|---|---|
| committer | 2026-04-24 01:33:23 +0000 | |
| commit | f5235631996aefdc1bb7914d7745f935d0d4a1fa (patch) | |
| tree | 89e1e957486942ad2aac3b7fcb66aa1ecacff3bb | |
| parent | delete rows to free up the names after their soft-deletions are processed (diff) | |
dynamic smokeping config... but only for master node so far
| -rwxr-xr-x | cronjob.py | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -5,6 +5,7 @@ from lib_autopeer import * import os +sp_conf_str = '' curs = DB.execute('SELECT name, asn FROM peers WHERE deleted=0') while row := curs.fetchone(): @@ -14,13 +15,27 @@ while row := curs.fetchone(): old_umask = os.umask(0o077) wgcfg = open(f'/etc/wireguard/wg{asn%10000:04}{name}.conf', 'w') os.umask(old_umask) - print(_bird_config(name, _get_peer_info(name, asn), _get_my_info(asn)), file=birdcfg) - print(_wg_config(name, _get_peer_info(name, asn), _get_my_info(asn)), file=wgcfg) + peer_info = _get_peer_info(name, asn) + my_info = _get_my_info(asn) + print(_bird_config(name, peer_info, my_info), file=birdcfg) + print(_wg_config(name, peer_info, my_info), file=wgcfg) + sp_conf_str += f''' ++++ {asn%10000:04}{name} +menu = {asn%10000:04}{name} +title = {asn}-{name} +remark = ICMP echo measured to WireGuard endpoint +host = {peer_info.endpoint} +''' birdcfg.close() wgcfg.close() os.system(f'systemctl enable --now wg-quick@wg{asn%10000:04}{name}') curs.close() +spcfg = open('/opt/autopeer/smokeping-peer.conf', 'w') +print(sp_conf_str, file=spcfg) +spcfg.close() +os.system('systemctl reload smokeping') + curs = DB.execute('SELECT name, asn FROM peers WHERE deleted=1') deletions = [] while row := curs.fetchone(): |
