Changeset 1216
- Timestamp:
- 03/08/10 08:47:29 (2 years ago)
- Files:
-
- 1 modified
-
trunk/unxsBind/bind.c (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/unxsBind/bind.c
r1215 r1216 86 86 strftime(cTime,31,"%b %d %T",tmTime); 87 87 88 fprintf(gLfp,"%s jobqueue.%s[%u]: %s\n",cTime,cFunction,pidThis,cLogline);88 fprintf(gLfp,"%s unxsBind.%s[%u]: %s\n",cTime,cFunction,pidThis,cLogline); 89 89 fflush(gLfp); 90 90 … … 969 969 { 970 970 //debug only 971 fprintf(stdout,"uDelete=%u uModify=%u uNew=%u uDeleteFirst=%u\n",972 uDelete,uModify,uNew,uDeleteFirst);971 //fprintf(stdout,"uDelete=%u uModify=%u uNew=%u uDeleteFirst=%u\n", 972 // uDelete,uModify,uNew,uDeleteFirst); 973 973 uChanged+=ProcessSlaveJob(cCurrentZone,uDelete,uModify, 974 974 uNew,uDeleteFirst,cNameServer,cMasterIP); … … 1008 1008 { 1009 1009 //debug only 1010 fprintf(stdout,"uDelete=%u uModify=%u uNew=%u uDeleteFirst=%u\n",1011 uDelete,uModify,uNew,uDeleteFirst);1010 //fprintf(stdout,"uDelete=%u uModify=%u uNew=%u uDeleteFirst=%u\n", 1011 // uDelete,uModify,uNew,uDeleteFirst); 1012 1012 uChanged+=ProcessSlaveJob(cCurrentZone,uDelete,uModify, 1013 1013 uNew,uDeleteFirst,cNameServer,cMasterIP); … … 1027 1027 if((uNamedCheckConf(cNameServer))) exit(1); //Exit without reloading the server 1028 1028 if(cuControlPort[0]) 1029 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reconfig",gcBinDir,cuControlPort); 1029 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reconfig > /dev/null 2>&1", 1030 gcBinDir,cuControlPort); 1030 1031 else 1031 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf reconfig ",gcBinDir);1032 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf reconfig > /dev/null 2>&1",gcBinDir); 1032 1033 1033 1034 if(system(cCmd)) … … 1057 1058 char cCmd[100]={""}; 1058 1059 1060 #ifdef cLOGFILE 1059 1061 if((gLfp=fopen(cLOGFILE,"a"))==NULL) 1060 1062 { … … 1062 1064 exit(300); 1063 1065 } 1066 #else 1067 gLfp=stdout; 1068 #endif 1064 1069 1065 1070 ConnectDb(); … … 1091 1096 { 1092 1097 //debug only 1093 fprintf(stdout,"uDelete=%u uModify=%u uNew=%u uDeleteFirst=%u\n",1094 uDelete,uModify,uNew,uDeleteFirst);1098 //fprintf(stdout,"uDelete=%u uModify=%u uNew=%u uDeleteFirst=%u\n", 1099 // uDelete,uModify,uNew,uDeleteFirst); 1095 1100 uChanged+=ProcessMasterJob(cCurrentZone,uDelete,uModify, 1096 1101 uNew,uDeleteFirst,cNameServer); … … 1107 1112 strcpy(cCurrentZone,field[2]); 1108 1113 } 1109 fprintf(stdout,"%s\t%s\t%s\n",field[0],field[2],field[1]); 1114 //debug only 1115 //fprintf(stdout,"%s\t%s\t%s\n",field[0],field[2],field[1]); 1110 1116 //Allow for combinations: Modify New, Delete New. Modify overrides a Delete. 1111 1117 if(strstr(field[1],"New")) uNew++; … … 1141 1147 } 1142 1148 } 1149 mysql_free_result(res); 1143 1150 1144 1151 if(!first) 1145 1152 { 1146 1153 //debug only 1147 fprintf(stdout,"uDelete=%u uModify=%u uNew=%u uDeleteFirst=%u\n",1148 uDelete,uModify,uNew,uDeleteFirst);1154 //fprintf(stdout,"uDelete=%u uModify=%u uNew=%u uDeleteFirst=%u\n", 1155 // uDelete,uModify,uNew,uDeleteFirst); 1149 1156 if((uChanged=ProcessMasterJob(cCurrentZone,uDelete,uModify, 1150 1157 uNew,uDeleteFirst,cNameServer))) … … 1156 1163 } 1157 1164 } 1158 // mysql_free_result(res);1159 1165 1160 1166 if(uReload) … … 1162 1168 if((uNamedCheckConf(cNameServer))) exit(1); //Will exit without server reload or reconfig 1163 1169 if(cuControlPort[0]) 1164 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reload",gcBinDir,cuControlPort); 1170 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reload > /dev/null 2>&1", 1171 gcBinDir,cuControlPort); 1165 1172 else 1166 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf reload ",gcBinDir);1173 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf reload > /dev/null 2>&1",gcBinDir); 1167 1174 1168 1175 if(system(cCmd)) … … 1173 1180 if((uNamedCheckConf(cNameServer))) exit(1); //Will exit without server reload or reconfig 1174 1181 if(cuControlPort[0]) 1175 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reconfig",gcBinDir,cuControlPort); 1182 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reconfig > /dev/null 2>&1", 1183 gcBinDir,cuControlPort); 1176 1184 else 1177 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf reconfig ",gcBinDir);1185 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf reconfig > /dev/null 2>&1",gcBinDir); 1178 1186 1179 1187 if(system(cCmd)) … … 1188 1196 1189 1197 1190 int ProcessMasterJob(char *cZone,unsigned uDelete,unsigned uModify,unsigned uNew, unsigned uDeleteFirst, char *cMasterNS) 1198 int ProcessMasterJob(char *cZone,unsigned uDelete,unsigned uModify, 1199 unsigned uNew,unsigned uDeleteFirst,char *cMasterNS) 1191 1200 { 1192 1201 //return 0 if nothing needs to be done … … 1195 1204 //return 3 if zone is modified but we need a reload anyway 1196 1205 //debug only 1197 fprintf(stdout,"Queue Policy for %s: ",cZone);1206 //fprintf(stdout,"Queue Policy for %s: ",cZone); 1198 1207 if(uDelete && !uNew) 1199 1208 { 1200 //debug only 1201 fprintf(stdout,"Delete for NS %s\n\n",cMasterNS); 1209 logfileLine("ProcessMasterJob","Delete"); 1202 1210 //Replace master.zones named.conf include file 1203 1211 //All Zones replace, DBFiles No, Stubs Yes … … 1207 1215 else if(uDelete && uNew && !uDeleteFirst) 1208 1216 { 1209 //debug only 1210 fprintf(stdout,"New then Delete\n\n"); 1217 logfileLine("ProcessMasterJob","New then Delete"); 1211 1218 return(0); 1212 1219 } … … 1215 1222 //debug only 1216 1223 if(uModify) 1217 fprintf(stdout,"New Modify for NS %s\n\n",cMasterNS);1224 logfileLine("ProcessMasterJob","New+Modify"); 1218 1225 else 1219 fprintf(stdout,"New for NS %s\n\n",cMasterNS);1226 logfileLine("ProcessMasterJob","New"); 1220 1227 //Append to master.zones named.conf include file 1221 1228 //Single zone append, DBFiles yes, Stubs yes … … 1226 1233 { 1227 1234 //debug only 1228 fprintf(stdout,"Modify for NS %s\n\n",cMasterNS);1235 logfileLine("ProcessMasterJob","Modify"); 1229 1236 //Single zone, DBFiles yes, Stubs yes 1230 1237 //We will always build stubs when modyfing a zone … … 1252 1259 1253 1260 //debug only 1254 fprintf(stdout,"Queue Policy for %s: ",cZone);1261 //fprintf(stdout,"Queue Policy for %s: ",cZone); 1255 1262 if(uDelete && !uNew) 1256 1263 { … … 1277 1284 CreateSlaveFiles(cMasterNS,"",cMasterIP,0); 1278 1285 if(cuControlPort[0]) 1279 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reload",gcBinDir,cuControlPort); 1286 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reload > /dev/null 2>&1", 1287 gcBinDir,cuControlPort); 1280 1288 else 1281 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf reload ",gcBinDir);1289 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf reload > /dev/null 2>&1",gcBinDir); 1282 1290 system(cCmd); 1283 1291 … … 1294 1302 //This is a hack has to be optimized further 1295 1303 if(cuControlPort[0]) 1296 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reload",gcBinDir,cuControlPort); 1304 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reload > /dev/null 2>&1", 1305 gcBinDir,cuControlPort); 1297 1306 else 1298 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf reload ",gcBinDir);1307 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf reload > /dev/null 2>&1",gcBinDir); 1299 1308 system(cCmd); 1300 1309 ViewReloadZone(cZone); … … 1583 1592 { 1584 1593 if(cuControlPort[0]) 1585 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s retransfer %s in %s ",1594 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s retransfer %s in %s > /dev/null 2>&1", 1586 1595 gcBinDir,cuControlPort,cZone,field[0]); 1587 1596 else 1588 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf retransfer %s in %s ",1597 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf retransfer %s in %s > /dev/null 2>&1", 1589 1598 gcBinDir,cZone,field[0]); 1590 1599 } … … 1592 1601 { 1593 1602 if(cuControlPort[0]) 1594 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reload %s in %s ",1603 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf -p %s reload %s in %s > /dev/null 2>&1", 1595 1604 gcBinDir,cuControlPort,cZone,field[0]); 1596 1605 else 1597 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf reload %s in %s ",1606 sprintf(cCmd,"%s/rndc -c /etc/unxsbind-rndc.conf reload %s in %s > /dev/null 2>&1", 1598 1607 gcBinDir,cZone,field[0]); 1599 1608 } 1600 1609 //debug only 1601 fprintf(stdout,"ViewReloadZone():%s\n",cCmd);1610 //fprintf(stdout,"ViewReloadZone():%s\n",cCmd); 1602 1611 uRetVal=system(cCmd); 1603 1612 }
