diff --git a/sysupd b/sysupd new file mode 100755 index 0000000..4ca87b9 --- /dev/null +++ b/sysupd @@ -0,0 +1,100 @@ +#!/bin/sh +# Update Various System Files, Ports, etc. +# $Id: sysupd,v 1.1 2006/02/10 06:18:42 root Exp $ + +CVSHOST=cvsup5.freebsd.org + +DIRCVS=/bku/LOGS +DIRMIRROR=/bku/LOGS +DIRNESSUS=/bku/LOGS + +##### +# List Of Sets To Process By Default +# Always Do The Ports Index Rebuild *After* The Ports CVSUP +##### + +DEFAULTSETS='mirror nessus ports stable index' + + +# Enter Timestamp Into Current Log + +timestamp() +{ + echo "" >> $1 + echo "#####" >> $1 + echo -n "# " >> $1 + date >>$1 + echo "#####" >> $1 + echo "" >> $1 +} + +##### +# Command line args override default set +##### + + +if [ $*_ = _ ] +then + SETS=$DEFAULTSETS +else + SETS=$* +fi + + +##### +# Process The Requested Updates +##### + +for SET in $SETS +do + + case $SET + in + + # Rebuild Ports Index + index) + + cd /usr/ports + make index + ;; + + + # Update Mirrored FreeBSD Files + mirror) + + LOGDIR=$DIRCVS + MYLOG=$LOGDIR/$SET.log + timestamp $MYLOG + touch $LOGDIR/.$SET-begin + /root/bin/mirror-freebsd 2>&1 >> $MYLOG + touch $LOGDIR/.$SET-end + + ;; + + + # Update The Nessus Plugins + nessus) + + LOGDIR=$DIRNESSUS + MYLOG=$LOGDIR/$SET.log + timestamp $MYLOG + touch $LOGDIR/.$SET-begin + /usr/local/sbin/nessus-update-plugins -v 2>&1 >> $MYLOG + touch $LOGDIR/.$SET-end + ;; + + + # CVSUP Updates + ports|stable) + + LOGDIR=$DIRCVS + MYLOG=$LOGDIR/cvsup-$SET.log + timestamp $MYLOG + touch $LOGDIR/.cvsup-$SET-begin + /usr/local/bin/cvsup -h $CVSHOST -g /root/cvsup/$SET-supfile 2>&1 >> $MYLOG + touch $LOGDIR/.cvsup-$SET-end + ;; + + esac + +done