marc/sync.py

70 lines
2.1 KiB
Python
Raw Normal View History

2022-05-01 20:58:23 +00:00
#! /usr/bin/env python3
import os
import subprocess
import pubnix
ARGS = [
{'dn':'aussies.space', 'sub': False},
{'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':'fr.tild3.org', 'sub': True},
2022-05-29 10:06:48 +00:00
{'dn':'freeshell.de', 'sub': False},
2022-05-01 20:58:23 +00:00
{'dn':'heathens.club', 'root': 'www', 'sub': False},
2022-06-25 22:33:48 +00:00
{'dn':'hextilde.xyz', 'sub': True},
2022-05-01 20:58:23 +00:00
{'dn':'insomnia247.nl', 'dir': True, 'sub': True},
{'dn':'remotes.club', 'port': 9022, 'root': 'web', 'sub': True},
{'dn':'rw.rs', 'sub': False},
{'dn':'squiggle.city', 'sub': False},
{'dn':'thunix.net', 'sub': False},
{'dn':'tilde.cafe', 'sub': True},
{'dn':'tilde.club', 'sub': False},
{'dn':'tilde.fun', 'root': 'html', 'sub': False},
2022-08-01 08:49:24 +00:00
{'dn':'tilde.green', 'sub': False},
2022-05-01 20:58:23 +00:00
{'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},
2022-09-30 21:01:40 +00:00
{'dn':'trash.town', 'sub': False},
2022-08-01 08:15:26 +00:00
{'dn':'vern.cc', 'sub': True},
2022-05-01 20:58:23 +00:00
{'dn':'sdf.org', 'root': 'html', 'sub': True},
{'dn':'southlondon.cc', 'sub': False},
]
PUBNIXES = [pubnix.PubNix(**args) for args in ARGS]
def sync(root, pubnix, exclude=None):
args = [
'rsync',
'--archive',
'--checksum',
'--delete-before',
'--rsh', f"ssh -o 'LogLevel Error' -p {pubnix.port}",
'--partial',
'--progress',
'--verbose',
os.path.join(root, str()),
]
for item in exclude:
args.extend(['--exclude', os.path.join(str(), item)])
args.append(os.path.join(pubnix.target, str()))
subprocess.call(args, stdout=subprocess.DEVNULL)
def main():
root = os.path.dirname(os.path.realpath(__file__))
for pubnix in PUBNIXES:
print()
print(pubnix)
sync(root, pubnix, exclude=['__pycache__', 'cnam', 'pgp.asc'])
# pubnix.disk_free()
if __name__ == '__main__':
main()