Skip to content

Instantly share code, notes, and snippets.

@dlangille
Created October 28, 2018 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlangille/0ef04d1394fde57d7ea7a9773776b34e to your computer and use it in GitHub Desktop.
Save dlangille/0ef04d1394fde57d7ea7a9773776b34e to your computer and use it in GitHub Desktop.
The start of a script for doing one long-test every. Will work fine if you have fewer drives than days in month.
#!/bin/sh
DRIVES=`/sbin/sysctl -n kern.disks`
DAY=`/bin/date +"%Oe"`
# yes, I could jump to the DAY-th element of the list
# Do you know how to do that?
TESTED=''
i=0;
for drive in ${DRIVES}
do
i=`expr ${i} + 1`;
if [ ${i} == ${DAY} ]
then
echo today I run a test on ${drive}
TESTED=${drive}
break;
fi
done
if [ "${TESTED}XX" == "XX" ]
then
echo nothing to test today
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment