#! /bin/sh # daily DCC cron job # This script should be run daily or more often when there is a shortage # of disk space to run dbclean to discard and compress old checksums. # It also discards old DCC client log files. #. By default it is installed in /usr/local/dcc/libexec. Instead of being copied # to a directory such as /etc/cron/daily on some systems, a symbolic link # should be used. # Copyright (c) 2006 by Rhyolite Software, LLC # # This agreement is not applicable to any entity which sells anti-spam # solutions to others or provides an anti-spam solution as part of a # security solution sold to other entities, or to a private network # which employs the DCC or uses data provided by operation of the DCC # but does not provide corresponding data to other users. # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # Parties not eligible to receive a license under this agreement can # obtain a commercial license to use DCC and permission to use # U.S. Patent 6,330,590 by contacting Commtouch at http://www.commtouch.com/ # or by email to nospam@commtouch.com. # # A commercial license would be for Distributed Checksum and Reputation # Clearinghouse software. That software includes additional features. This # free license for Distributed ChecksumClearinghouse Software does not in any # way grant permision to use Distributed Checksum and Reputation Clearinghouse # software # # THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE, LLC DISCLAIMS ALL # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE, LLC # BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, # ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS # SOFTWARE. # Rhyolite Software DCC 1.3.50-1.61 $Revision$ # Generated automatically from cron-dccd.in by configure. exec 1>&2 /dev/null fi if test -n "$USERDIRS"; then find $USERDIRS -follow \ \( \( -name 'msg.*' -mtime +$DBCLEAN_LOGDAYS \) \ -o \( -name 'tmp.*' -mtime +2 \) \) -print \ | /usr/bin/xargs /bin/rm -f fi fi # Notify users about new log files. # The file $DCC_LIBEXEC/webuser-notify must be a script that will send # a suitable message. See the example in the cgi-bin directory. if test -n "$USERDIRS" -a -x $DCC_LIBEXEC/webuser-notify; then for DIR in $USERDIRS; do MARKER=$DIR/notify.marker touch $MARKER.new if test -r $MARKER; then NEWER="-newer $MARKER" else NEWER= fi # Find usernames with a pending message or with a new # but not newer than new log file # Avoid newer than new files to ensure we generate at most # one notification per log file. find $DIR -follow \( -name notify.pending \ -o \( -name 'msg.*' $NEWER \) \) \ ! -newer $MARKER.new -print \ | sed -n -e 's@.*/\([^/]*/[^/]*\)/log/msg\.[^/]*$@\1@p' \ -e 's@.*/\([^/]*/[^/]*\)/notify.pending$@\1@p' \ | LC_ALL=C sort -u \ | $DCC_LIBEXEC/webuser-notify $DEBUG -d "$DIR" mv -f $MARKER.new $MARKER done fi # trim the greylist database case X"$GREY_ENABLE" in [oO][nN]) GREY_ENABLE=on ;; X) if test -n "$GREY_CLIENT_ARGS"; then GREY_ENABLE=on fi ;; esac if test -n "$GREY_SRVR_ID" -a "$GREY_ENABLE" = on; then $DCC_LIBEXEC/dbclean -Gon -i $GREY_SRVR_ID $GREY_DBCLEAN_ARGS fi # Delete old checksums from the dccd database if it seems dccd can run. # For historical reasons, SRVR_ID set and DCCD_ENABLE nul # turns on dccd case "$DCCD_ENABLE" in [oO][fF][fF]) DCCD_ENABLE=off;; *) DCCD_ENABLE=on;; esac if test -n "$SRVR_ID" -a "$DCCD_ENABLE" = on; then $DCC_LIBEXEC/dbclean -i $SRVR_ID $SADDR $DBCLEAN_ARGS fi # encourage local DCC clients to switch back /usr/local/bin/cdcc rtt >/dev/null 2>&1