• Script for creating groups

    From ejs@Usernet.eternal-september@seniejitrakai.net to news.software.nntp on Thu Jan 1 15:03:07 2026
    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
  • From =?UTF-8?Q?Julien_=C3=89LIE?=@iulius@nom-de-mon-site.com.invalid to news.software.nntp on Sun Jan 4 21:34:45 2026
    From Newsgroup: news.software.nntp

    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:
    -a for ng in res_groups:
    -a-a-a res = F"sudo {ctlinnd} newgroup {ng} {ng_opt}"
    -a-a-a print(F"Executing '{res}'")
    -a-a-a os.system(res)
    else:
    -a 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 |eLIE

    -2-aL'ordinateur ob|-it |a vos ordres, pas |a vos intentions.-a-+

    --- Synchronet 3.21a-Linux NewsLink 1.2