#!/bin/ksh -p # # This script will perform ZFS filesystem scrubs and send a text # message upon completion # ####################################################################### # # Variables: # Name of zpool to scrub POOL_NAME=ZFSDATA1 # Name of cellular carrier (Check Google Send to Phone for list) CARRIER=VERIZON # 10 digit cell phone number to send text message to PHONE_NUMBER=1234567890 # # Temporarily disable cron so that hourly snapshots do not interfere with # scrub process svcadm disable cron # # Start scrub process and wait until scrub is complete to continue zpool scrub $POOL_NAME SCRUB_STATUS=1 until [ "$SCRUB_STATUS" -eq 0 ] do sleep 30 SCRUB_STATUS=`zpool status ZFSDATA1 | grep -c 'scrub in progress'` done SCRUB_COMPLETE=`zpool status ZFSDATA1 | grep scrub:` # # Reenable cron svcadm enable cron # # Send text message upon completion /ZFSDATA1/LOGS/sendtext.sh $CARRIER $PHONE_NUMBER " $SCRUB_COMPLETE " # exit # Add to crontab 5 0 1 * * /ZFSDATA1/LOGS/ZFSscrub.ksh