keeping freebsd uptodate - doubt

J65nko BSD j65nko at gmail.com
Sat Feb 5 19:36:22 PST 2005


On Fri, 04 Feb 2005 22:16:30 -0600, Billy Newsom <billy at nlcc.us> wrote:
> saravanan ganapathy wrote:
>  >   cvsup -g -L 2 /root/ports-supfile
>
> Once you get your cvsup stuff straightened out, try this script, which I run
> every other day.  Change the Log file if you want.  This updates my sources
> to stable and updates the ports tree.  I use two different cvsup files and
> commands so the two don't get confused.  Don't try to use the same config
> file and cvsup command for the two different types of updates!!  (In my
> experience, you're asking for trouble.)
>
> You will need to install a few ports first, but you should get the idea.  If
> you read the output every day (or you could email it to yourself, which I may
> eventually do if I like it), you will see which ports need to be updated.
> This script will probably contiune to get better as it gets added to.  Like I
> need to include the security audited version of ports that need updated!
>
> BEGIN CODE... mydaily.sh
> #!/bin/sh
> #
> # Billy borrowed stuff on 12/18/2004 from:
> #http://www.oreillynet.com/pub/wlg/6041?page=last&x-order=date
> #
> LOGF="/var/log/cvsup.log"
> echo "START @ `/bin/date`" >>$LOGF
> #/bin/date >>$LOGF
> #use fastest_cvsup to find fastest geographically
> #close mirror; I'll check Canada and the US
>
> if SERVER=`/usr/local/bin/fastest_cvsup -Q -c ca,us`; then
>     echo "Using STABLE Server:" $SERVER >>$LOGF
>     /usr/local/bin/cvsup -L1 -h $SERVER -l /var/log/cvs-lock-s
> /root/stable-supfile >>$LOGF
>     echo "STABLE done @ `/bin/date`" >>$LOGF
>   else
>    echo "cvsup-STABLE has a fastest_cvsup problem on...`/bin/date`" >>$LOGF
> fi
>
> if SERVER=`/usr/local/bin/fastest_cvsup -Q -c ca,us`; then
>     echo "Using PORTS Server:" $SERVER >>$LOGF
>     /usr/local/bin/cvsup -L0 -h $SERVER -l /var/log/cvs-lock-p
> /root/ports-supfile >>$LOGF
>     echo "PORTS done @ `/bin/date`" >>$LOGF
>   else
>    echo "cvsup-PORTS has a fastest_cvsup problem on...`/bin/date`" >>$LOGF
> fi
>
> #-U (which takes a long time to execute) isn't needed
> #with the fetchindex command
> cd /usr/ports
> make fetchindex >>$LOGF
> /usr/local/sbin/portsdb -u >>$LOGF
> # command1 2>&1 | command2
>
> # echo "Looking for security patches"
> # freebsd-update fetch
> # This program not working for me.  unComment above line if it works for U.
>
> echo "The following ports need upgrading" >>$LOGF
> /usr/local/sbin/portversion -l "<" >>$LOGF
> echo "" >>$LOGF
> echo "STOP at `/bin/date`." >>$LOGF
> echo "********" >>$LOGF
>
> END CODE... mydaily.sh
>
> --
> Billy
> _______________________________________________
You can use "exec"  at the top of your script to redirect all output
to a file. This way don't need to add ">>$LOG" at the end of each
line.

--------------------
#!/bin/sh

LOGF="/var/log/cvsup.log"

# --- redirect all script output to logfile
exec >>${LOGF}  2>&1

------------------------
=Adriaan=


More information about the freebsd-questions mailing list