Skip to content

Instantly share code, notes, and snippets.

@SiKing
Created January 18, 2017 18:25
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 SiKing/6be5565af7224e5090eed1b83a5dd1d6 to your computer and use it in GitHub Desktop.
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.
#!/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