#! /bin/sh # start dccifd # This script assumes that it is being run by root or the DCC user, probably # while the system is starting. See the misc/rcDCC script. # --S-LICENSE-- # $Revision: 1.37 $ # @configure_input@ exec 1>&2 /dev/null; then DCCIFD_ARGS="'-l$DCCIFD_LOGDIR' $DCCIFD_ARGS" else DCCIFD_ARGS="-l$DCCIFD_LOGDIR $DCCIFD_ARGS" fi fi CKS="$REP_ARGS" if test -n "$DCCIFD_LOG_AT$DCCIFD_REJECT_AT"; then for CK in ${DCCIFD_CKSUMS:=CMN} $DCCIFD_XTRA_CKSUMS; do CKS="$CKS -t$CK,$DCCIFD_LOG_AT,$DCCIFD_REJECT_AT" done fi DCCIFD_ARGS="$CKS $DNSBL_ARGS $DCC_LOG_ARGS $DCCIFD_ARGS" USAGE="`basename $0`: [-xv] [-h homedir] [-r rundir] [-a args]" OPTIND=1 while getopts "xvAh:r:a:" c; do case $c in x) ;; v) ;; A) ;; h) ;; r) DCC_RUNDIR="$OPTARG";; a) DCCIFD_ARGS="$DCCIFD_ARGS $OPTARG";; *) eval $DCC_LOGGER \"$USAGE\"; exit 1;; esac done shift `expr $OPTIND - 1 || true` if test "$#" -ne 0; then eval $DCC_LOGGER \"$USAGE\" exit 1 fi if test -n "$DCC_RUNDIR" -a "$DCC_RUNDIR" != @dcc_rundir@; then DCCIFD_ARGS="-R$DCC_RUNDIR $DCCIFD_ARGS" fi # stop an existing dccifd # signal the process group because on Linux systems signaling the main # process does not work. See `man sigwait` on a Linux system. PID=`cat $DCC_RUNDIR/dccifd.pid 2>/dev/null` if test -n "$PID"; then if test -n "$AUTOSTART"; then if kill -0 "$PID" 2>/dev/null; then eval $DCC_LOGGER \"dccifd already running\" exit 0 fi else CNT=0 # try for 20 seconds to let Solaris finish waiting for DNSBL answers while test $CNT -le 20; do if `kill -15 $PID 2>/dev/null`; then if test -z "$QUIET" -a $CNT -gt 0; then if test $CNT -eq 1; then echo " stopping dccifd PID $PID " | tr -d '\012' else echo "." | tr -d '\012' fi fi sleep 1 CNT=`expr $CNT + 1` else break fi done kill -9 $PID 2>/dev/null if test $CNT -gt 1 -a -z "$QUIET"; then echo fi fi fi if test -z "$AUTOSTART"; then case "$DCCIFD_ENABLE" in [oO][nN]);; *) exit 0 ;; esac fi if test ! -x $DCC_LIBEXEC/dccifd; then if test -z "$AUTOSTART"; then eval $DCC_LOGGER \"cannot start dccifd because it has not been installed\" fi exit 0 fi if test ! -d $DCC_RUNDIR; then mkdir $DCC_RUNDIR fi if test -n "$DCCUID"; then chown $DCCUID "$DCC_RUNDIR" if test -d "$DCC_HOMEDIR"; then chown "$DCCUID" "$DCC_HOMEDIR" fi if test -n "$DCCIFD_LOGDIR" -a -d "$DCCIFD_LOGDIR"; then chown "$DCCUID" "$DCCIFD_LOGDIR" fi fi # first try to use `su -` to set limits # fall back to -I for systems where su requires a valid shell in # /etc/passwd but the dcc user does not have one if test -n "$DCCUID" -a X"$DCCUID" != X"$USER"; then if @DCC_SU@ $DCCUID -c date >/dev/null 2>&1; then @DCC_SU@ $DCCUID -c "$DCC_LIBEXEC/dccifd $DCCIFD_ARGS" exit fi DCCIFD_ARGS="-I$DCCUID $DCCIFD_ARGS" fi eval $DCC_LIBEXEC/dccifd $DCCIFD_ARGS