]> git.pld-linux.org Git - packages/awffull.git/blobdiff - awffull.cron
- FORCE_USER option
[packages/awffull.git] / awffull.cron
index d67335aa2d3ab9d3ab9345b75a072d2aaaee0cf4..1dc4e49dde330bea671314665a078cc9f9c09d26 100644 (file)
@@ -1,26 +1,46 @@
 #!/bin/sh
 
 AWFFULL_OPTS=""
+CONFIG_LIST=""
 [ -f /etc/sysconfig/awffull ] && . /etc/sysconfig/awffull
 umask 0022
 
+if [ -n "$FORCE_USER" ]; then
+       if [ "$FORCE_USER" != "`id -un`" ]; then
+               echo "Wrong current user. $FORCE_USER is required!"
+               exit 1
+       fi
+fi
+
 if [ -n "$ENABLE" ] && [ "$ENABLE" = "yes" -o "$ENABLE" = "YES" ]; then
        LC_ALL=$LANG
        export LANG
        export LC_ALL
        
-       if [ -n "$REALLY_QUIET" ] && [ "$REALLY_QUIET" = "yes" -o "$REALLY_QUIET" = "YES" ]; then
-               AWFFULL_OPTS="-Q"
-       elif [ -n "$QUIET" ] && [ "$QUIET" = "yes" -o "$QUIET" = "YES" ]; then
+       if [ -n "$QUIET" ] && [ "$QUIET" = "yes" -o "$QUIET" = "YES" ]; then
                AWFFULL_OPTS="-q"
+       elif [ -n "$REALLY_QUIET" ] && [ "$REALLY_QUIET" = "yes" -o "$REALLY_QUIET" = "YES" ]; then
+               AWFFULL_OPTS="-Q"
        fi
        
-       if [ -f /etc/awffull.conf ]; then
-               awffull ${AWFFULL_OPTS} -c /etc/awffull.conf
-       fi
        if [ -n "$MULTIPLE" ] && [ "$MULTIPLE" = "yes" -o "$MULTIPLE" = "YES" ]; then
-               for i in $(ls /etc/awffull/*.conf 2>/dev/null); do
-                       awffull ${AWFFULL_OPTS} -c $i;
+               for config in $(ls /etc/awffull/*.conf 2>/dev/null); do\
+                       CONFIG_LIST="${CONFIG_LIST} ${config}"
                done
+       else
+               CONFIG_LIST="/etc/awffull.conf"
        fi
+
+       for singleconfig in ${CONFIG_LIST}; do
+               if [ -n "${USE_DNSHISTORY}" ] && [ "${USE_DNSHISTORY}" = "yes" -o "${USE_DNSHISTORY}" = "YES" ]; then
+                       TMPCONFIG=`mktemp -q /var/lib/dnshistory/awffull_config.XXXXXX`
+                       LOGFILE=`grep ^LogFile ${singleconfig} | awk '{ print $2;}'`
+                       grep -v ^LogFile ${singleconfig} > ${TMPCONFIG}
+                       nice -n 19 dnshistory -f ${LOGFILE}
+                       nice -n 19 dnshistory -T -f ${LOGFILE} | awffull ${AWFFULL_OPTS} -c ${TMPCONFIG} - ;
+                       rm -f ${TMPCONFIG}
+               else
+                       nice -n 19 awffull ${AWFFULL_OPTS} -c ${singleconfig};
+               fi
+       done
 fi
This page took 0.059552 seconds and 4 git commands to generate.