On 08/11/15 08:21, Marko Cupać wrote:

> - Next morning I get notification from freebsd-cron for the same update
>   I installed yesterday, but only for /usr/share/man/whatis. (not ok)

Did you by any chance happend to run the weekly/320.makewhatis periodic
script that night?   It is enabled by default.  However, you shouldn't
need it if you maintain your system entirely through freebsd-update.

> Are there any differences between freebsd-update cron and
> freebsd-update fetch, apart from random time offset?

freebsd-update is a shell script, so it's fairly easy to see the
difference between 'fetch' and 'cron' -- look for the functions
'cmd_fetch()' and 'cmd_cron()' in the code (they're right next to each
other.)

The differences are:

   'fetch' tests that is is connected to a tty and complains about not
           being run interactively if not

   'cron'  sleeps for a random number of seconds up to 1 hour, and it
           logs everything it does to a temporary file in order to mail
           back a report to the user if needed.

Otherwise, they both call exactly the same 'fetch_check_params()' and
'fetch_run()' functions.

        Cheers,

        Matthew


# Fetch command.  Make sure that we're being called
# interactively, then run fetch_check_params and fetch_run
cmd_fetch () {
        if [ ! -t 0 -a $NOTTYOK -eq 0 ]; then
                echo -n "`basename $0` fetch should not "
                echo "be run non-interactively."
                echo "Run `basename $0` cron instead."
                exit 1
        fi
        fetch_check_params
        fetch_run || exit 1
}

# Cron command.  Make sure the parameters are sensible; wait
# rand(3600) seconds; then fetch updates.  While fetching updates,
# send output to a temporary file; only print that file if the
# fetching failed.
cmd_cron () {
        fetch_check_params
        sleep `jot -r 1 0 3600`

        TMPFILE=`mktemp /tmp/freebsd-update.XXXXXX` || exit 1
        if ! fetch_run >> ${TMPFILE} ||
            ! grep -q "No updates needed" ${TMPFILE} ||
            [ ${VERBOSELEVEL} = "debug" ]; then
                mail -s "`hostname` security updates" ${MAILTO} < ${TMPFILE}
        fi

        rm ${TMPFILE}
}


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to