smartmontools and update-smart-drivedb

Carmel NY carmel_ny at outlook.com
Wed Apr 29 17:57:20 UTC 2020


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 at tavi.co.uk> wrote:
>
>> The port doesn't get updated every time there is a new drive
>> database; that would be unworkable.
>>  
>
>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=$(pwd)

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

# Get the last modification time of 'drivedb.h'
OLD=$(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/branches/RELEASE_7_0_DRIVEDB/smartmontools/drivedb.h

# Get the last modification time of 'drivedb.h'
NEW=$(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

-- 
Carmel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20200429/c4395de5/attachment.sig>


More information about the freebsd-ports mailing list