/
usr
/
lib
/
imh-dnskeyapi
/
/usr/lib/imh-dnskeyapi
mkdir
upload
Name
Size
Mode
Actions
tests/
-
0755
rm
venv/
-
0755
rm
sync_user_zones
967
0755
edit
dl
rm
Edit:
/usr/lib/imh-dnskeyapi/sync_user_zones
(967B)
#!/usr/lib/imh-dnskeyapi/venv/bin/python3 """Syncs all zones owned by the user to the cluster""" from argparse import ArgumentParser from pathlib import Path import shlex from subprocess import run def main(): """Syncs all zones owned by the user to the cluster""" parser = ArgumentParser(description=__doc__) parser.add_argument('--user', help='cPanel user') user: str = parser.parse_args().user sync(user) def sync(user: str): """Run dnscluster synczone in serial for each domain for a user""" with open('/etc/userdomains', encoding='utf-8') as file: for line in file: domain, owner = line.strip().split(': ', maxsplit=1) if owner != user or not Path(f"/var/named/{domain}.db").exists(): continue cmd = ["/usr/local/cpanel/scripts/dnscluster", "synczone", domain] print(shlex.join(cmd)) run(cmd, check=False) if __name__ == '__main__': main()
Save
cmd:
run