Created
January 18, 2017 18:25
-
-
Save SiKing/6be5565af7224e5090eed1b83a5dd1d6 to your computer and use it in GitHub Desktop.
madadm needs some periodic maintenance scripts - each one is documented in the script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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