Skip to content

Instantly share code, notes, and snippets.

@phunehehe
Last active December 28, 2015 16:09
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 phunehehe/7526955 to your computer and use it in GitHub Desktop.
Save phunehehe/7526955 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
monthday="$(date +%-d)"
weekday="$(date +%w)"
if [[ "$monthday" -eq 1 ]]
then
config=monthly
elif [[ "$weekday" -eq 0 ]]
then
config=weekly
else
config=daily
fi
string=$(
sudo -u amandabackup amreport $config |
grep FAILED |
awk '{print $1}' |
sort -u |
while read host
do
echo -n " .$host "
done
)
[[ "$string" = "" ]] && exit 0
sudo -u amandabackup amdump $config $string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment