Date: Tue, 11 Aug 2015 09:31:04 +0100 From: Matthew Seaman <matthew@freebsd.org> To: =?UTF-8?Q?Marko_Cupa=c4=87?= <marko.cupac@mimar.rs>, freebsd-stable@freebsd.org Subject: Re: (once again) freebsd-update cron and man whatis Message-ID: <55C9B2C8.6020406@freebsd.org> In-Reply-To: <20150811092154.0252ba46@efreet> References: <20150811092154.0252ba46@efreet>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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 #2 --]
-----BEGIN PGP SIGNATURE-----
iQIcBAEBCgAGBQJVybLYAAoJEABRPxDgqeTn/nAQALInNQvAFjSvjTfWugPt4brz
OUjdnua+gOV1jxm3+Tp2USHJg9YvNKBK/vdpKRx9Js7ln21DXSbhtLNPQNBk9J4W
EN++iseEZFZAPKdpoQaBmKZN/MB6TP6SaiXc5PjN7nzOYlCDKNTSmn4iNLIF8Gec
Qr/S16fkCf30TRvb26uqVv+km+PagLVSGAxM5C6Vk+p6EPbbBU5GtEoPdIFA1qim
/wFZ8kHI29BQJeLV+1eiOLh6sG+djz0ORonILdy8SLYmLmgP14iNUW25WOpU6it+
0sExj1om+HDu9i7/3bFl/sRm+UB4rv/TnCm/0PrkNr5wogZJCi4hNby2D7dN5mx+
tvNkjeOOOsuv7MeNq+ZYIniW8X52RVphDs0bNuk9c3477n+QKH+BlkmAG5v+G6Ml
XQfUI8Z9rxIfywruEvTxCLa4Hpf0e9xcVklDhQAVvtDbXvZkGAIk/3j0lYSgBtZp
URjyANqDTt2SOoWS2YPsrbLuBh1Y+42dA6L3b5raZ8n3OEx1STqWQgVJhOLk13yI
/CEMSjkDAoGnEQWGbHYhOhtsjNd5+GrRBR2MHwju1W+a2KG2h1s6bfG99BR9havv
XwBLh6Y/4C1V4NnecjqTzb1iJADJ9EdmT1n3CW92e+KggCVoef8mp9s37xQOWzMw
kh367qG4Upa1wowrrNhk
=NMXi
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?55C9B2C8.6020406>
