Uwe Driessen
Junior Member
Posts: 21
Joined: Feb 2009
Reputation: 0
|
RE: power dns einbindung
(03-20-2009 09:58 AM)FISA4 Wrote: Wie wäre es mit:
wenn Du das meinst...
z.B.:
Code:
SELECT
subdomain_alias_id,
alias_id,
subdomain_alias_name,
subdomain_alias_mount,
subdomain_alias_statuse hope that it will be useful,
FROM
subdomain_alias
";
($rs, $rdata) = doSQL($sql);
dann versuchs mal mit :
Code:
$rs->subdomain_alias_name
als Array-Variable zu benutzen.
Evtl. ist es aber auch:
Code:
$rs['subdomain_alias_name']
ich habs nun einfach in SQL geschrieben mit einer Variablen aus dem als_mgr
Den Status könnte ich noch einbauen um evtl. "Vorbestellungen" abzufangen muß ich mir noch anschauen welche zustände das Feld außer delete/change/toadd noch haben kann.
PDNS kommt auf dem Server zusammen mit poweradmin zum Einsatz.
Code:
INSERT INTO pdns.domains (name,type)
SELECT t1.alias_name , 'NATIVE'
FROM ispcp.domain_aliasses t1
WHERE t1.alias_id = $main::als_task_id;
-- A Record
INSERT INTO pdns.records (domain_id, name, type, content, ttl, change_date)
SELECT t4.id, t1.alias_name,'A', t3.ip_number, 21600, Unix_timestamp()
FROM ispcp.domain_aliasses AS t1, ispcp.domain AS t2, ispcp.server_ips AS t3, pdns.domains AS t4
WHERE t2.domain_id = t1.domain_id
AND t4.name = t1.alias_name
and t3.ip_id = t2.domain_ip_id
AND t1.alias_id = $main::als_task_id;
INSERT INTO pdns.records (domain_id, name, type, content, ttl, change_date)
SELECT t4.id, concat('mail.',t1.alias_name),'A', t3.ip_number, 21600, Unix_timestamp()
FROM ispcp.domain_aliasses AS t1, ispcp.domain AS t2, ispcp.server_ips AS t3, pdns.domains AS t4
WHERE t2.domain_id = t1.domain_id
AND t4.name = t1.alias_name
and t3.ip_alias = 'mail'
AND t1.alias_id = $main::als_task_id;
INSERT INTO pdns.records (domain_id, name, type, content, ttl, change_date)
SELECT t4.id, concat('ns1.',t1.alias_name),'A', t3.ip_number, 21600, Unix_timestamp()
FROM ispcp.domain_aliasses AS t1, ispcp.domain AS t2, ispcp.server_ips AS t3, pdns.domains AS t4
WHERE t2.domain_id = t1.domain_id
AND t4.name = t1.alias_name
and t3.ip_alias = 'ns1'
AND t1.alias_id = $main::als_task_id;
INSERT INTO pdns.records (domain_id, name, type, content, ttl, change_date)
SELECT t4.id, concat('ns2l.',t1.alias_name),'A', t3.ip_number, 21600, Unix_timestamp()
FROM ispcp.domain_aliasses AS t1, ispcp.domain AS t2, ispcp.server_ips AS t3, pdns.domains AS t4
WHERE t2.domain_id = t1.domain_id
AND t4.name = t1.alias_name
and t3.ip_alias = 'ns2'
AND t1.alias_id = $main::als_task_id;
-- NS Record
INSERT INTO pdns.records (domain_id, name, type, content, ttl, change_date)
SELECT t4.id, t1.alias_name,'NS', concat('ns1.',t1.alias_name), 21600, Unix_timestamp()
FROM ispcp.domain_aliasses AS t1, ispcp.domain AS t2, ispcp.server_ips AS t3, pdns.domains AS t4
WHERE t2.domain_id = t1.domain_id
AND t4.name = t1.alias_name
and t3.ip_id = t2.domain_ip_id
AND t1.alias_id = $main::als_task_id;
INSERT INTO pdns.records (domain_id, name, type, content, ttl, change_date)
SELECT t4.id, t1.alias_name,'NS', concat ('ns2.',t1.alias_name), 21600, Unix_timestamp()
FROM ispcp.domain_aliasses AS t1, ispcp.domain AS t2, ispcp.server_ips AS t3, pdns.domains AS t4
WHERE t2.domain_id = t1.domain_id
AND t4.name = t1.alias_name
AND t3.ip_id = t2.domain_ip_id
AND t1.alias_id = $main::als_task_id;
-- SOA Record
INSERT INTO pdns.records (domain_id, name, type, content, ttl, change_date)
SELECT t4.id, t1.alias_name,'SOA', concat('ns1.deltaweb.de. hostmaster.',t1.alias_name,'.', curdate()+0,'4800 3600 43200 21600'),
21600, Unix_timestamp()
FROM ispcp.domain_aliasses AS t1, ispcp.domain AS t2, ispcp.server_ips AS t3, pdns.domains AS t4
WHERE t2.domain_id = t1.domain_id
AND t4.name = t1.alias_name
AND t3.ip_id = t2.domain_ip_id
AND t1.alias_id = $main::als_task_id;
-- MX RECORD
INSERT INTO pdns.records (domain_id, name, type, content, ttl, prio, change_date)
SELECT t4.id, t1.alias_name,'MX',concat('mail.',t1.alias_name), 21600, 10, Unix_timestamp()
FROM ispcp.domain_aliasses AS t1, ispcp.domain AS t2, ispcp.server_ips AS t3, pdns.domains AS t4
WHERE t2.domain_id = t1.domain_id
AND t4.name = t1.alias_name
AND t3.ip_id = t2.domain_ip_id
AND t1.alias_id = $main::als_task_id;
-- DOmain alias löschen
DELETE FROM pdns.records t1 JOIN ispcp.domain_aliasses t2 ON t2.alias_name = t1.name
JOIN pdns.domains t3 ON t3.name = t1.name
WHERE t1.domain_id = t3.id
AND t2.alias_id = $main::als_task_id;
DELETE FROM pdns.domains t1 where t1.name in (select t3.alias_name FROM ispcp.domain_aliasses t3
where t3.alias_id = $main::als_task_id);
jetzt lasse ich den Kollegen noch suchen wo er es in die Perl Scripte von VHCS einbindet.
evtl. werden wir dann noch einen kompletten Patch zu der Geschichte veröffentlichen.
Schöner wäre es wenn ich die richtigen Variablen innerhalb des Perl hätte dann müßte ich keinen select für den Insert machen.
Vorteil bei der reinen SQL-geschichte ich habs komplett unter der Kontrolle. :-)
In der Beschreibung zum Einbinden von PDNS sind mir auch noch ein paar Kleinigkeiten aufgefallen die kommen dann mit den Patch.
(This post was last modified: 03-20-2009 10:24 AM by Uwe Driessen.)
|
|