Instantly share code, notes, and snippets.

Embed
What would you like to do?
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