Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Apr 2020 13:57:05 -0400
From:      Carmel NY <carmel_ny@outlook.com>
To:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: smartmontools and update-smart-drivedb
Message-ID:  <SN6PR04MB5021A41B1294CEEAE316576980AD0@SN6PR04MB5021.namprd04.prod.outlook.com>
In-Reply-To: <CAK82gMGg9tF2Tm_BsO0bHPwa9-ej5Qg-GeF6yuXaGOjVt3=LhA@mail.gmail.com>
References:  <SN6PR04MB5021A8218A5D99DEC45291A780AD0@SN6PR04MB5021.namprd04.prod.outlook.com> <20200429135204.1411a8cc@raksha.tavi.co.uk> <SN6PR04MB5021AF3DB9809DCDC2640EF680AD0@SN6PR04MB5021.namprd04.prod.outlook.com> <20200429161956.7525adaa@raksha.tavi.co.uk> <CAK82gMGg9tF2Tm_BsO0bHPwa9-ej5Qg-GeF6yuXaGOjVt3=LhA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/NEiDnm6yXy.ythAyX1EOTz.
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Wed, 29 Apr 2020 12:00:35 -0400, Dan McGrath stated:
>Hi,
>
>On Wed, Apr 29, 2020 at 11:20 AM Bob Eager <rde@tavi.co.uk> wrote:
>
>> The port doesn't get updated every time there is a new drive
>> database; that would be unworkable.
>> =20
>
>Just a thought, but perhaps something similar to what ntp does with:
>
>  service ntpd fetch
>
>But of course using smartd, so that it can fetch something upstream?

I just wrote a simple script that uses curl to check if a newer file is
available and download it if needed. It is trivial to get it to run via
cron once a month.

#! /usr/bin/env bash

declare -i OLD
declare -i NEW

# Get the present directory
cwd=3D$(pwd)

# Switch to the smartmontools directory
cd "/usr/local/share/smartmontools"

# Get the last modification time of 'drivedb.h'
OLD=3D$(stat -f %m drivedb.h 2> /dev/null)

# Use curl to download the 'drivedb.h' file if newer
curl -s -R -z "drivedb.h" -O https://www.smartmontools.org/export/5053/bran=
ches/RELEASE_7_0_DRIVEDB/smartmontools/drivedb.h

# Get the last modification time of 'drivedb.h'
NEW=3D$(stat -f %m drivedb.h 2> /dev/null)

# Print the date and time
printf "%s\n\n" "$(date)"

# See if we got a new file
if [[ "${NEW}" -gt "${OLD}" ]]; then
    printf "New /usr/local/share/smartmontools/drivedb.h file downloaded.\n"
else
    printf "/usr/local/share/smartmontools/drivedb.h not updated.\n"
fi

# Get back to where we started
cd ${cwd}

# We are out of here
exit

--=20
Carmel

--Sig_/NEiDnm6yXy.ythAyX1EOTz.
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEIQb/tTwl6I1ueEVtOHMGOIfexWQFAl6pv/EACgkQOHMGOIfe
xWS+YQf7BNLM2hzyVIErKuGAutary3DcgbESs1cmi/MjAXEkEMdu/gc0zEKIlwd4
jHShUZsQMN27NYX6+okOZjwpxfZVIVZYGW0VGi4vuFmKowTmViyntLxqvETguqNJ
J7LyXyBMipPlGtU1M62ZTPVsPSPIU9Ny8DlioyiPzeUd9hlEP30ggtJpssXLjLVU
YD8SYJU6Ptplr8MFI0P+giwll41M5Him3g+9FJ0yoTlf5mn3D9+D6GRkUxQHda0N
mruacci7/3KcbnmtnudMOaafUtz6doHkt7i6znDaCPuPIKcgwiUpuQx3lb//lvqU
IN8nK782pcxT0Ogfr3Lmnx6NXZQsFg==
=hFMe
-----END PGP SIGNATURE-----

--Sig_/NEiDnm6yXy.ythAyX1EOTz.--



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