From Newsgroup: news.software.nntp
Hi folks,
i've migrated the INN2 server recently to another host.
A Python script recreating the visible group hierarhy appeared.
Free to use and improve.
#!/bin/python3
import nntplib
import os
ctlinnd = '/usr/lib/news/bin/ctlinnd'
ng_opt = "y"
nntp_source = nntplib.NNTP('source.news.server')
nntp_target = nntplib.NNTP('target.news.server')
source_groups = list()
target_groups = list()
res_groups = list()
try:
s_ng = nntp_source.list()
except nntplib.NNTPTemporaryError:
pass
try:
t_ng = nntp_target.list()
except nntplib.NNTPTemporaryError:
print('Something wrong with this yougurt')
for ng in t_ng[1]:
if ng.group not in target_groups:
target_groups.append(ng.group)
for ng in s_ng[1]:
if ng.group not in target_groups:
res_groups.append(ng.group)
print(F"Appending TARGET: {ng.group}")
if len(res_groups) > 0:
for ng in res_groups:
res = F"sudo {ctlinnd} newgroup {ng} {ng_opt}"
print(F"Executing '{res}'")
os.system(res)
else:
print("\n\tNothing to do. Everything is already in sync.")
--
ejs
news://news.rkm.lt
--- Synchronet 3.21a-Linux NewsLink 1.2