Graph-IT

cron_smart_check.php

This script allows to run a S.M.A.R.T.-test on disk drives and to check the results.

Usage:

cron_smart_check.php [disk1] ... <action>

Parameters:

Note: In case no disks (disk1 ...) are listed, the action will be performed on all available drives.

Side note: We usually run this script every two hours with attributCheck through the crontab.

# Smart Checks
0 6 * * 1-6 /usr/sbin/smartctl -q errorsonly --test=short
0 6 * * 7  /usr/sbin/smartctl -q errorsonly --test=long
15 */2 * * * <path to cron_smart_check.php> attributCheck

We don't use it to call short/long tests.

Note: If you call this script through a cronjob, the PATH of the crontab might need to be extended. The default 'PATH' only uses '/usr/bin:/bin' (on Uubntu) and thus 'which' wouldn't find smartctl!

Adding:

# extending PATH; default is '/usr/bin:/bin'
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

will fix the PATH-problem.