marc/sync.py

83 lines
2.3 KiB
Python
Raw Normal View History

2022-05-01 22:58:23 +02:00
#! /usr/bin/env python3
2025-02-18 21:16:35 +01:00
from logging import log
2022-05-01 22:58:23 +02:00
import os
import subprocess
import pubnix
ARGS = [
2025-02-18 20:58:05 +01:00
{
"dn": "blinkenshell.org",
"ssh": "ssh",
"port": 2222,
"web": "u",
"sub": True,
},
{"dn": "ctrl-c.club", "sub": False},
{"dn": "dimension.sh", "sub": True},
{"dn": "envs.net", "sub": True},
{"dn": "freeshell.de", "sub": False},
2024-02-24 23:33:54 +01:00
# {'dn':'hextilde.xyz', 'sub': True},
2025-02-18 20:58:05 +01:00
{"dn": "insomnia247.nl", "dir": True, "sub": True},
{"dn": "p.projectsegfau.lt", "sub": True},
2024-02-24 23:22:38 +01:00
# {'dn':'pubnix.pink', 'web': 'sites', 'sub': False},
2025-02-18 20:58:05 +01:00
{"dn": "rawtext.club", "sub": False},
{"dn": "rw.rs", "sub": False},
{"dn": "thunix.net", "sub": False},
{"dn": "tilde.32bit.cafe", "root": "www", "sub": False},
{"dn": "tilde.cafe", "sub": True},
{"dn": "tilde.club", "sub": False},
{"dn": "tilde.fun", "root": "html", "sub": False},
{"dn": "tilde.green", "sub": False},
{"dn": "tilde.guru", "sub": False},
{"dn": "tilde.institute", "sub": True},
{"dn": "tilde.pink", "sub": False},
{"dn": "tilde.team", "sub": True},
{"dn": "tilde.town", "sub": False},
2024-02-24 23:23:59 +01:00
# {'dn':'trash.town', 'sub': False},
2023-10-08 15:00:44 +02:00
# permissions
2024-02-25 19:50:18 +01:00
# {'dn':'sdf.org', 'root': 'html', 'sub': True},
2023-10-08 15:00:44 +02:00
# old
2025-02-18 20:58:05 +01:00
{"dn": "fr.tild3.org", "sub": True},
{"dn": "remotes.club", "port": 9022, "root": "web", "sub": True},
{"dn": "squiggle.city", "sub": False},
2023-10-08 15:00:44 +02:00
# down
# {'dn':'aussies.space', 'sub': False},
# {'dn':'heathens.club', 'root': 'www', 'sub': False},
# {'dn':'vern.cc', 'sub': True},
2022-05-01 22:58:23 +02:00
]
PUBNIXES = [pubnix.PubNix(**args) for args in ARGS]
def sync(root, pubnix, exclude=None):
args = [
2025-02-18 20:58:05 +01:00
"rsync",
"--archive",
"--checksum",
"--delete-before",
"--rsh",
f"ssh -o 'LogLevel Error' -p {pubnix.port}",
"--partial",
"--progress",
"--verbose",
2025-02-18 21:16:35 +01:00
os.path.join(root, ""),
2022-05-01 22:58:23 +02:00
]
for item in exclude:
2025-02-18 20:58:05 +01:00
args.extend(["--exclude", os.path.join(str(), item)])
2022-05-01 22:58:23 +02:00
args.append(os.path.join(pubnix.target, str()))
subprocess.call(args, stdout=subprocess.DEVNULL)
def main():
root = os.path.dirname(os.path.realpath(__file__))
2025-02-18 20:58:05 +01:00
root = os.path.join(root, "out", "web")
2025-02-18 21:16:35 +01:00
for pn in PUBNIXES:
log()
log(pn)
sync(root, pn, exclude=["__pycache__", "pgp.asc"])
2022-05-01 22:58:23 +02:00
2025-02-18 20:58:05 +01:00
if __name__ == "__main__":
2022-05-01 22:58:23 +02:00
main()