-
Notifications
You must be signed in to change notification settings - Fork 0
/
postwwwacct
executable file
·65 lines (51 loc) · 1.29 KB
/
postwwwacct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python
# Nginx Admin Installer
# Website: www.nginxcp.com
#
# Copyright (C) NGINXCP.COM.
#
import sys
import smtplib
import subprocess
k = 1
v = 2
argdict = {}
while k < len(sys.argv):
argdict[sys.argv[k]] = sys.argv[v]
k += 2
v += 2
args = open("/root/args.txt", "w")
args.writelines(argdict)
args.close
import os
import xmlapi
from xml.dom import minidom
import sys
sys.path.append('/scripts')
import createvhosts
import yaml
dedip = argdict['useip']
newuser = argdict['user']
ipDOC = xmlapi.api("listips")
parsedipDOC = minidom.parseString(ipDOC)
iptaglist = parsedipDOC.getElementsByTagName('ip')
iplist =[]
q = 0
while q < len(iptaglist):
iplist.append(str(iptaglist[q].childNodes[0].toxml()))
q = q + 1
f = open('/var/cpanel/userdata/' + newuser + '/main')
ydata = yaml.load(f)
f.close()
sublist = ydata['sub_domains']
addondict = ydata['addon_domains']
parkedlist = ydata['parked_domains']
domainlist = ydata['main_domain']
domain = domainlist
docroot, yip, alias = createvhosts.getvars(domain)
if yip == iplist[0]:
createvhosts.writeconfshared(newuser, domain, docroot, yip, alias)
else:
createvhosts.writeconfded(newuser, domain, docroot, yip, alias)
proc = subprocess.Popen("/etc/init.d/nginx restart > /dev/null 2>&1", shell=True)
output = proc.communicate()