🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
2 messages
2 total messages Started by ejs Thu, 01 Jan 2026 13:03
Script for creating groups
#92597
Author: ejs
Date: Thu, 01 Jan 2026 13:03
54 lines
2233 bytes
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
Re: Script for creating groups
#92599
Author: Julien ÉLIE
Date: Sun, 04 Jan 2026 20:34
25 lines
2035 bytes
Hi ejs,

> i've migrated the INN2 server recently to another host.
> A Python script recreating the visible group hierarhy appeared.
> 
> 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.")

Thanks for sharing your Python script!

FWIW, INN comes with a program called actsync which can also perform 
such a synchronization between two news servers.  See the examples 
section at:
     https://www.eyrie.org/~eagle/software/inn/docs/actsync.html

-- 
Julien ÉLIE

« L'ordinateur obéit à vos ordres, pas à vos intentions. »
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads