Changeset 1216

Show
Ignore:
Timestamp:
03/08/10 08:47:29 (2 years ago)
Author:
Gary
Message:

unxsBind started work on cleaning up jobqueue processing logging.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/unxsBind/bind.c

    r1215 r1216  
    8686        strftime(cTime,31,"%b %d %T",tmTime); 
    8787 
    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); 
    8989        fflush(gLfp); 
    9090 
     
    969969                                { 
    970970                                        //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);  
    973973                                        uChanged+=ProcessSlaveJob(cCurrentZone,uDelete,uModify, 
    974974                                                        uNew,uDeleteFirst,cNameServer,cMasterIP); 
     
    10081008        { 
    10091009                //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);  
    10121012                uChanged+=ProcessSlaveJob(cCurrentZone,uDelete,uModify, 
    10131013                                uNew,uDeleteFirst,cNameServer,cMasterIP); 
     
    10271027                if((uNamedCheckConf(cNameServer))) exit(1); //Exit without reloading the server 
    10281028                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); 
    10301031                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); 
    10321033                 
    10331034                if(system(cCmd)) 
     
    10571058        char cCmd[100]={""}; 
    10581059 
     1060#ifdef cLOGFILE 
    10591061        if((gLfp=fopen(cLOGFILE,"a"))==NULL) 
    10601062        { 
     
    10621064                exit(300); 
    10631065        } 
     1066#else 
     1067        gLfp=stdout; 
     1068#endif 
    10641069         
    10651070        ConnectDb(); 
     
    10911096                                { 
    10921097                                        //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);  
    10951100                                        uChanged+=ProcessMasterJob(cCurrentZone,uDelete,uModify, 
    10961101                                                uNew,uDeleteFirst,cNameServer); 
     
    11071112                                strcpy(cCurrentZone,field[2]); 
    11081113                        } 
    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]); 
    11101116                        //Allow for combinations: Modify New, Delete New. Modify overrides a Delete. 
    11111117                        if(strstr(field[1],"New")) uNew++; 
     
    11411147                } 
    11421148        } 
     1149        mysql_free_result(res); 
    11431150 
    11441151        if(!first) 
    11451152        { 
    11461153                //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);  
    11491156                if((uChanged=ProcessMasterJob(cCurrentZone,uDelete,uModify, 
    11501157                                uNew,uDeleteFirst,cNameServer))) 
     
    11561163                } 
    11571164        } 
    1158 //      mysql_free_result(res); 
    11591165 
    11601166        if(uReload) 
     
    11621168                if((uNamedCheckConf(cNameServer))) exit(1); //Will exit without server reload or reconfig 
    11631169                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); 
    11651172                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); 
    11671174                 
    11681175                if(system(cCmd)) 
     
    11731180                if((uNamedCheckConf(cNameServer))) exit(1); //Will exit without server reload or reconfig 
    11741181                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); 
    11761184                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); 
    11781186                 
    11791187                if(system(cCmd)) 
     
    11881196 
    11891197 
    1190 int ProcessMasterJob(char *cZone,unsigned uDelete,unsigned uModify,unsigned uNew, unsigned uDeleteFirst, char *cMasterNS) 
     1198int ProcessMasterJob(char *cZone,unsigned uDelete,unsigned uModify, 
     1199                        unsigned uNew,unsigned uDeleteFirst,char *cMasterNS) 
    11911200{ 
    11921201        //return 0 if nothing needs to be done 
     
    11951204        //return 3 if zone is modified but we need a reload anyway 
    11961205        //debug only 
    1197         fprintf(stdout,"Queue Policy for %s: ",cZone); 
     1206        //fprintf(stdout,"Queue Policy for %s: ",cZone); 
    11981207        if(uDelete && !uNew) 
    11991208        { 
    1200                 //debug only 
    1201                 fprintf(stdout,"Delete for NS %s\n\n",cMasterNS); 
     1209                logfileLine("ProcessMasterJob","Delete"); 
    12021210                //Replace master.zones named.conf include file 
    12031211                //All Zones replace, DBFiles No, Stubs Yes 
     
    12071215        else if(uDelete && uNew && !uDeleteFirst) 
    12081216        { 
    1209                 //debug only 
    1210                 fprintf(stdout,"New then Delete\n\n"); 
     1217                logfileLine("ProcessMasterJob","New then Delete"); 
    12111218                return(0); 
    12121219        } 
     
    12151222                //debug only 
    12161223                if(uModify) 
    1217                         fprintf(stdout,"New Modify for NS %s\n\n",cMasterNS); 
     1224                        logfileLine("ProcessMasterJob","New+Modify"); 
    12181225                else 
    1219                         fprintf(stdout,"New for NS %s\n\n",cMasterNS); 
     1226                        logfileLine("ProcessMasterJob","New"); 
    12201227                //Append to master.zones named.conf include file 
    12211228                //Single zone append, DBFiles yes, Stubs yes 
     
    12261233        { 
    12271234                //debug only 
    1228                 fprintf(stdout,"Modify for NS %s\n\n",cMasterNS); 
     1235                logfileLine("ProcessMasterJob","Modify"); 
    12291236                //Single zone, DBFiles yes, Stubs yes 
    12301237                //We will always build stubs when modyfing a zone 
     
    12521259         
    12531260        //debug only 
    1254         fprintf(stdout,"Queue Policy for %s: ",cZone); 
     1261        //fprintf(stdout,"Queue Policy for %s: ",cZone); 
    12551262        if(uDelete && !uNew) 
    12561263        { 
     
    12771284                CreateSlaveFiles(cMasterNS,"",cMasterIP,0); 
    12781285                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); 
    12801288                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); 
    12821290                system(cCmd); 
    12831291                 
     
    12941302                //This is a hack has to be optimized further 
    12951303                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); 
    12971306                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); 
    12991308                system(cCmd); 
    13001309                ViewReloadZone(cZone); 
     
    15831592                { 
    15841593                        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", 
    15861595                                                gcBinDir,cuControlPort,cZone,field[0]); 
    15871596                        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", 
    15891598                                                gcBinDir,cZone,field[0]); 
    15901599                } 
     
    15921601                { 
    15931602                        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", 
    15951604                                                gcBinDir,cuControlPort,cZone,field[0]); 
    15961605                        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", 
    15981607                                                gcBinDir,cZone,field[0]); 
    15991608                } 
    16001609                //debug only 
    1601                 fprintf(stdout,"ViewReloadZone():%s\n",cCmd); 
     1610                //fprintf(stdout,"ViewReloadZone():%s\n",cCmd); 
    16021611                uRetVal=system(cCmd); 
    16031612        }