Add optiom for exyra restic options.

Nake restic exclusion actually work.

Add zabbix report script.
This commit is contained in:
Rob Pearce 2020-10-02 21:23:42 +10:00
parent 62cc31ca1e
commit d2039b040c
2 changed files with 19 additions and 5 deletions

12
bare.sh
View File

@ -42,10 +42,10 @@ function updatestats() {
} }
function usage-repo() { function usage-repo() {
echo " reponame1;/path/to/files1/;tag1,tag2,...,tagX;repo_url;repo_passfile;repo_excludefail" echo " reponame1;/path/to/files1/;tag1,tag2,...,tagX;repo_url;repo_passfile;repo_excludefile"
echo " reponame2;/path/to/files2/;tag1,tag2,...,tagX;repo_url;repo_passfile;repo_excludefail" echo " reponame2;/path/to/files2/;tag1,tag2,...,tagX;repo_url;repo_passfile;repo_excludefile"
echo " ..." echo " ..."
echo " reponameX;/path/to/filesX/;tag1,tag2,...,tagX;repo_url;repo_passfile;repo_excludefail" echo " reponameX;/path/to/filesX/;tag1,tag2,...,tagX;repo_url;repo_passfile;repo_excludefile"
echo "" echo ""
echo " Default password file is: $DEF_AUTHFILE" echo " Default password file is: $DEF_AUTHFILE"
echo "" echo ""
@ -69,6 +69,7 @@ function usage-rc() {
echo " export B2_BUCKET_PREFIX=xxx # Prefix to append to create unique B2 bucket name" echo " export B2_BUCKET_PREFIX=xxx # Prefix to append to create unique B2 bucket name"
echo "" echo ""
echo " export RESTIC_KEEPDAYS=31 # Days to keep restic backups for" echo " export RESTIC_KEEPDAYS=31 # Days to keep restic backups for"
echo " export RESTICOPTS=\"--one-file-system\" # Extra args to pass to restic"
echo "" echo ""
echo " export DEF_RSYNC_SERVER=xxx # Server used for repos with 'rsync' tag" echo " export DEF_RSYNC_SERVER=xxx # Server used for repos with 'rsync' tag"
echo " export DEF_RSYNC_USER=backups # Username for rsync server" echo " export DEF_RSYNC_USER=backups # Username for rsync server"
@ -134,7 +135,7 @@ function getmode() {
function getrepoexcludefile() { # output path function getrepoexcludefile() { # output path
local res rv local res rv
res=`getrepotok $1 7` res=`getrepotok $1 6`
rv=$? rv=$?
echo "$res" echo "$res"
return $rv return $rv
@ -587,8 +588,9 @@ for f in $REPOSTOBACKUP; do
export RESTIC_EXCLUDEFILE=`getrepoexcludefile "$f"` export RESTIC_EXCLUDEFILE=`getrepoexcludefile "$f"`
if [[ ! -z $RESTIC_PASSWORD_FILE ]]; then if [[ ! -z $RESTIC_PASSWORD_FILE ]]; then
OTHEROPTS="$OTHEROPTS -exclude-file=${RESTIC_EXCLUDE}" OTHEROPTS="$OTHEROPTS --exclude-file=${RESTIC_EXCLUDEFILE}"
fi fi
OTHEROPTS="$OTHEROPTS $RESTICOPTS"
elif [[ $mode == "rsync" ]]; then elif [[ $mode == "rsync" ]]; then
# rsync # rsync
MYREPO="rsync: $REPO_PATH" MYREPO="rsync: $REPO_PATH"

12
report.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
BARE=/root/scripts/bare/bare.sh
SENDER=/usr/local/bin/zabbix_sender
CONF=/etc/zabbix/zabbix_agentd.conf
ZABBIXHOST=gridbug.nethack.net
TEXT="`$BARE -a check`"
RV=$?
$SENDER -c $CONF -k backuptext -o "$TEXT" -s $ZABBIXHOST
$SENDER -c $CONF -k backupstatus -o $RV -s $ZABBIXHOST