Heray-Was-Here
Server : Apache
System : Linux vps37394.inmotionhosting.com 3.10.0-1160.119.1.vz7.224.4 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User : jasonp18 ( 1000)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /usr/lib/imh-dnskeyapi/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib/imh-dnskeyapi/sync_user_zones
#!/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()

Hry