Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
madadm needs some periodic maintenance scripts - each one is documented in the script.
#!/bin/bash -e
#
# Goal:
# madadm needs some periodic maintenance scripts - each one is documented in the script.
#
echo "Are we superuser?"
[[ $EUID -eq 0 ]]
echo "OK"
echo "Are we running on the rPi?"
[[ "$(uname --machine)" == arm* ]]
echo "OK"
echo "Is mdadm actually installed?"
mdadm --version
echo "OK"
PERIOD=daily
SCRIPT=sync_boot_partition
echo "Setup ${PERIOD}:${SCRIPT}."
cp --force lib/$SCRIPT /etc/cron.$PERIOD/
run-parts --test /etc/cron.$PERIOD | grep --quiet $SCRIPT
echo "OK"
echo "Try the first boot sync."
echo ">>> Start"
/etc/cron.daily/sync_boot_partition
echo "<<< End"
echo "OK"
PERIOD=weekly
SCRIPT=raid_check
echo "Setup ${PERIOD}:${SCRIPT}."
cp --force lib/$SCRIPT /etc/cron.$PERIOD/
run-parts --test /etc/cron.$PERIOD | grep --quiet $SCRIPT
echo "OK"
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment