projects
/
matthijs
/
upstream
/
backupninja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixup ldap SSL/TLS options, make TLS default in helper, Closes: Trac#13
[matthijs/upstream/backupninja.git]
/
src
/
backupninja.in
diff --git
a/src/backupninja.in
b/src/backupninja.in
index 7430176f306a5a5cbde29eaab2099ac38a5a2889..34c0bd618e265fff7211d497609512985729b8e1 100755
(executable)
--- a/
src/backupninja.in
+++ b/
src/backupninja.in
@@
-34,7
+34,7
@@
function setupcolors () {
function colorize () {
if [ "$usecolors" == "yes" ]; then
function colorize () {
if [ "$usecolors" == "yes" ]; then
- local typestr=`echo "$@" |
sed
's/\(^[^:]*\).*$/\1/'`
+ local typestr=`echo "$@" |
@SED@
's/\(^[^:]*\).*$/\1/'`
[ "$typestr" == "Debug" ] && type=0
[ "$typestr" == "Info" ] && type=1
[ "$typestr" == "Warning" ] && type=2
[ "$typestr" == "Debug" ] && type=0
[ "$typestr" == "Info" ] && type=1
[ "$typestr" == "Warning" ] && type=2
@@
-68,7
+68,7
@@
function printmsg() {
type=$1
shift
if [ $type == 100 ]; then
type=$1
shift
if [ $type == 100 ]; then
- typestr=`echo "$@" |
sed
's/\(^[^:]*\).*$/\1/'`
+ typestr=`echo "$@" |
@SED@
's/\(^[^:]*\).*$/\1/'`
[ "$typestr" == "Debug" ] && type=0
[ "$typestr" == "Info" ] && type=1
[ "$typestr" == "Warning" ] && type=2
[ "$typestr" == "Debug" ] && type=0
[ "$typestr" == "Info" ] && type=1
[ "$typestr" == "Warning" ] && type=2
@@
-178,7
+178,7
@@
function tolower() {
# simple to integer function
function toint() {
# simple to integer function
function toint() {
- echo "$1" | tr -d
[:alpha:]
+ echo "$1" | tr -d
'[:alpha:]'
}
#
}
#
@@
-204,7
+204,7
@@
function isnow() {
whendayofweek=$1; at=$2; whentime=$3;
whenday=`toint "$whendayofweek"`
whendayofweek=`tolower "$whendayofweek"`
whendayofweek=$1; at=$2; whentime=$3;
whenday=`toint "$whendayofweek"`
whendayofweek=`tolower "$whendayofweek"`
- whentime=`echo "$whentime" |
sed 's/:[0-9][0-9]$//' | sed
-r 's/^([0-9])$/0\1/'`
+ whentime=`echo "$whentime" |
@SED@ 's/:[0-9][0-9]$//' | @SED@
-r 's/^([0-9])$/0\1/'`
if [ "$whendayofweek" == "everyday" -o "$whendayofweek" == "daily" ]; then
whendayofweek=$nowdayofweek
if [ "$whendayofweek" == "everyday" -o "$whendayofweek" == "daily" ]; then
whendayofweek=$nowdayofweek
@@
-409,7
+409,7
@@
if [ ! -r "$conffile" ]; then
fi
# find $libdirectory
fi
# find $libdirectory
-libdirectory=`grep '^libdirectory' $conffile |
awk
'{print $3}'`
+libdirectory=`grep '^libdirectory' $conffile |
@AWK@
'{print $3}'`
if [ -z "$libdirectory" ]; then
if [ -d "@libdir@" ]; then
libdirectory="@libdir@"
if [ -z "$libdirectory" ]; then
if [ -d "@libdir@" ]; then
libdirectory="@libdir@"
@@
-433,9
+433,12
@@
setfile $conffile
# get global config options (second param is the default)
getconf configdirectory @CFGDIR@/backup.d
getconf scriptdirectory @datadir@
# get global config options (second param is the default)
getconf configdirectory @CFGDIR@/backup.d
getconf scriptdirectory @datadir@
+getconf reportdirectory
getconf reportemail
getconf reportemail
+getconf reporthost
getconf reportspace
getconf reportsuccess yes
getconf reportspace
getconf reportsuccess yes
+getconf reportuser
getconf reportwarning yes
getconf loglevel 3
getconf when "Everyday at 01:00"
getconf reportwarning yes
getconf loglevel 3
getconf when "Everyday at 01:00"
@@
-445,6
+448,7
@@
getconf usecolors "yes"
getconf SLAPCAT /usr/sbin/slapcat
getconf LDAPSEARCH /usr/bin/ldapsearch
getconf RDIFFBACKUP /usr/bin/rdiff-backup
getconf SLAPCAT /usr/sbin/slapcat
getconf LDAPSEARCH /usr/bin/ldapsearch
getconf RDIFFBACKUP /usr/bin/rdiff-backup
+getconf CSTREAM=/usr/bin/cstream
getconf MYSQLADMIN /usr/bin/mysqladmin
getconf MYSQL /usr/bin/mysql
getconf MYSQLHOTCOPY /usr/bin/mysqlhotcopy
getconf MYSQLADMIN /usr/bin/mysqladmin
getconf MYSQL /usr/bin/mysql
getconf MYSQLHOTCOPY /usr/bin/mysqlhotcopy
@@
-540,12
+544,11
@@
if [ $doit == 1 ]; then
if [ "$reportspace" == "yes" ]; then
previous=""
for i in $(ls "$configdirectory"); do
if [ "$reportspace" == "yes" ]; then
previous=""
for i in $(ls "$configdirectory"); do
- backuploc=$(grep ^directory "$configdirectory"/"$i" |
awk
'{print $3}')
+ backuploc=$(grep ^directory "$configdirectory"/"$i" |
@AWK@
'{print $3}')
if [ "$backuploc" != "$previous" ]; then
if [ "$backuploc" != "$previous" ]; then
- mountdev=$(mount | grep "$backuploc" | awk '{print $1}')
- df -h "$mountdev"
+ df -h "$backuploc"
previous="$backuploc"
previous="$backuploc"
-
fi
+ fi
done
fi
} | mail -s "backupninja: $hostname $subject" $reportemail
done
fi
} | mail -s "backupninja: $hostname $subject" $reportemail
@@
-554,3
+557,8
@@
fi
if [ $actions_run != 0 ]; then
info "FINISHED: $actions_run actions run. $fatals fatal. $errors error. $warnings warning."
fi
if [ $actions_run != 0 ]; then
info "FINISHED: $actions_run actions run. $fatals fatal. $errors error. $warnings warning."
fi
+
+if [ -n "$reporthost" ]; then
+ debug "send $logfile to $reportuser@$reporthost:$reportdirectory"
+ rsync -qt $logfile $reportuser@$reporthost:$reportdirectory
+fi