فهرست منبع

update whois_filt script, add primitive std[err|out] logging to rc.ripe-filter, and remove daily section logic from rip_whois process which logs using ISO dates already

Michael Schloh von Bennewitz 21 سال پیش
والد
کامیت
11a62935bb
5فایلهای تغییر یافته به همراه45 افزوده شده و 51 حذف شده
  1. 0 16
      ripe-dbase/rc.ripe-dbase
  2. 0 16
      ripe-dbase/rc.ripe-dbase.extobjs
  3. 30 1
      ripe-dbase/rc.ripe-filter
  4. 2 2
      ripe-dbase/ripe-dbase.spec
  5. 13 16
      ripe-dbase/whois_filt.pl

+ 0 - 16
ripe-dbase/rc.ripe-dbase

@@ -5,11 +5,6 @@
 
 %config
     ripe_dbase_enable="$openpkg_rc_def"
-    ripe_dbase_log_prolog="true"
-    ripe_dbase_log_epilog="true"
-    ripe_dbase_log_numfiles="10"
-    ripe_dbase_log_minsize="1M"
-    ripe_dbase_log_complevel="9"
 
 %common
     ripe_dbase_pidfile="@l_prefix@/var/ripe-dbase/whois_rip.pid"
@@ -44,14 +39,3 @@
     rcService ripe-dbase active no  && exit 0
     rc ripe-dbase stop start
 
-%daily -u @l_susr@
-    rcService ripe-dbase enable yes || exit 0
-
-    #   rotate logfile
-    shtool rotate -f \
-        -n ${ripe_dbase_log_numfiles} -s ${ripe_dbase_log_minsize} -d \
-        -z ${ripe_dbase_log_complevel} -m 644 -o @l_susr@ -g @l_sgrp@ \
-        -P "${ripe_dbase_log_prolog}" \
-        -E "${ripe_dbase_log_epilog} && rc ripe_dbase restart" \
-        @l_prefix@/var/ripe-dbase/log/whois_rip.err.log
-

+ 0 - 16
ripe-dbase/rc.ripe-dbase.extobjs

@@ -5,11 +5,6 @@
 
 %config
     ripe_dbase_enable="$openpkg_rc_def"
-    ripe_dbase_log_prolog="true"
-    ripe_dbase_log_epilog="true"
-    ripe_dbase_log_numfiles="10"
-    ripe_dbase_log_minsize="1M"
-    ripe_dbase_log_complevel="9"
 
 %common
     ripe_dbase_pidfile="@l_prefix@/var/ripe-dbase/whois_rip.pid"
@@ -54,14 +49,3 @@
     rcService ripe-dbase active no  && exit 0
     rc ripe-dbase stop start
 
-%daily -u @l_susr@
-    rcService ripe-dbase enable yes || exit 0
-
-    #   rotate logfile
-    shtool rotate -f \
-        -n ${ripe_dbase_log_numfiles} -s ${ripe_dbase_log_minsize} -d \
-        -z ${ripe_dbase_log_complevel} -m 644 -o @l_susr@ -g @l_sgrp@ \
-        -P "${ripe_dbase_log_prolog}" \
-        -E "${ripe_dbase_log_epilog} && rc ripe_dbase restart" \
-        @l_prefix@/var/ripe-dbase/log/whois_rip.err.log
-

+ 30 - 1
ripe-dbase/rc.ripe-filter

@@ -5,6 +5,16 @@
 
 %config
     ripe_filter_enable="$openpkg_rc_def"
+    ripe_filter_out_prolog="true"
+    ripe_filter_out_epilog="true"
+    ripe_filter_out_numfiles="10"
+    ripe_filter_out_minsize="1M"
+    ripe_filter_out_complevel="9"
+    ripe_filter_err_prolog="true"
+    ripe_filter_err_epilog="true"
+    ripe_filter_err_numfiles="10"
+    ripe_filter_err_minsize="1M"
+    ripe_filter_err_complevel="9"
 
 %common
     ripe_filter_pidfile="@l_prefix@/var/ripe-dbase/whois_filt.pid"
@@ -24,7 +34,9 @@
 %start -u @l_susr@
     rcService ripe-filter enable yes || exit 0
     rcService ripe-filter active yes && exit 0
-    @l_prefix@/bin/whois_filt &
+    @l_prefix@/bin/whois_filt \
+        1>>@l_prefix@/var/ripe-dbase/log/filtout.log \
+        2>>@l_prefix@/var/ripe-dbase/log/filterr.log &
 
 %stop -u @l_susr@
     rcService ripe-filter enable yes || exit 0
@@ -41,3 +53,20 @@
 %daily -u @l_susr@
     rcService ripe-filter enable yes || exit 0
 
+%daily -u @l_susr@
+    rcService ripe-filter enable yes || exit 0
+
+    #   rotate logfiles
+    shtool rotate -f \
+        -n ${ripe_filter_out_numfiles} -s ${ripe_filter_out_minsize} -d \
+        -z ${ripe_filter_out_complevel} -m 644 -o @l_susr@ -g @l_sgrp@ \
+        -P "${ripe_filter_out_prolog}" \
+        -E "${ripe_filter_out_epilog} && rc ripe_dbase restart" \
+        @l_prefix@/var/ripe-dbase/log/filtout.log
+    shtool rotate -f \
+        -n ${ripe_filter_err_numfiles} -s ${ripe_filter_err_minsize} -d \
+        -z ${ripe_filter_err_complevel} -m 644 -o @l_susr@ -g @l_sgrp@ \
+        -P "${ripe_filter_err_prolog}" \
+        -E "${ripe_filter_err_epilog} && rc ripe_dbase restart" \
+        @l_prefix@/var/ripe-dbase/log/filterr.log
+

+ 2 - 2
ripe-dbase/ripe-dbase.spec

@@ -34,7 +34,7 @@ Class:        EVAL
 Group:        Database
 License:      RIPE NCC
 Version:      3.2.0
-Release:      20040323
+Release:      20040326
 
 #   package options
 %option       with_extobjs  no
@@ -61,7 +61,7 @@ PreReq:       gnupg, glib, glib::with_threads = yes, mysql3
 BuildPreReq:  libxml, libxslt, imap, zlib, openssl
 PreReq:       libxml, libxslt, imap, zlib, openssl
 %if "%{with_extobjs}" == "yes"
-PreReq:       perl-ripe
+PreReq:       ripe-asused
 %endif
 AutoReq:      no
 AutoReqProv:  no

+ 13 - 16
ripe-dbase/whois_filt.pl

@@ -3,7 +3,7 @@
 #
 # whois wrapper to filter out private objects and attributes
 #
-# By Arnd Vehling, NetHead - 11/03/2004
+# Arnd Vehling, NetHead - 11/03/2004
 #
 # For Cable & Wireless Munic
 #
@@ -25,24 +25,23 @@
   # Glob Vars
   #
 
-  # Whois Server Definition
-  my %ldb = ('Host' => '@l_hostname@',  'Port' => '43001', 
-	     'Mode' => 0);
+  # Where to write the pidfile. Specify "none" for none.
+  my $pidfile = '@l_prefix@/var/ripe-dbase/whois_filt.pid';
 
-  my @header = (
-  "% This is the Cable & Wireless Whois server.\n",
-  "% The objects are in RPSL format.\n",
-  "%\n",
-  "% Rights restricted by copyright.\n\n"
-  );
+  my $header = "% This is the Cable & Wireless Whois server.\n% The objects are in RPSL format.\n%\n% Rights restricted by copyright.\n";
   
   # Configuration file with private definitions
   my $config="@l_prefix@/etc/ripe-dbase/whois_filt.config";
 
+
   # All whois objects go into this
   my @src_objects = ();
   my @privates    = ();
 
+  # Whois Server Definition
+  my %ldb = ('Host' => 'localhost',  'Port' => '43001', 
+	     'Mode' => 0);
+
   # Which source
   my $local_source  = "ARINCW";
 
@@ -106,8 +105,6 @@
       print "Query error: $myerr\n";
       exit 3;
     }
-
-    $source_whois->destroy();
   }
 
   ##
@@ -158,8 +155,7 @@
       &do_query( $query );
 
       # Print header
-      #map {($rc = printf $sock)} @header;
-      $rc = printf $sock @header;
+      $rc = printf $sock $header;
 
       if (!$rc) {
 	  $self->Error("Client connection error %s",
@@ -193,7 +189,7 @@
 	}
 	$source =~ s/\n\n/\n/g;
 
-	print("\n$source\n");
+	#print("\n$source\n");
 	$rc = printf $sock ("\n$source\n");
 
 	if (!$rc) {
@@ -225,7 +221,8 @@
   package Main;
 
   # Create Server
-  my $server = cwho->new({'pidfile' => '@l_prefix@/var/ripe-dbase/whois_filt.pid', 'localport' => 43}, \@ARGV);
+  my $server = cwho->new({'pidfile' => $pidfile,
+                                'localport' => 43}, \@ARGV);
   # Bind to address/port, run server
   $server->Bind();