Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Feb 2005 04:36:19 +0100
From:      J65nko BSD <j65nko@gmail.com>
To:        FreeBSD Mailing list <freebsd-questions@freebsd.org>
Subject:   Re: keeping freebsd uptodate - doubt
Message-ID:  <19861fba05020519366aec830e@mail.gmail.com>
In-Reply-To: <4204489E.3000703@nlcc.us>
References:  <20050202131936.59448.qmail@web51702.mail.yahoo.com> <4204489E.3000703@nlcc.us>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 04 Feb 2005 22:16:30 -0600, Billy Newsom <billy@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=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19861fba05020519366aec830e>