]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Add configure variables to baculabackupreport. Patch from bug #2538
authorCarsten Leonhardt <leo@debian.org>
Tue, 9 Jun 2020 12:21:40 +0000 (14:21 +0200)
committerKern Sibbald <kern@sibbald.com>
Tue, 9 Jun 2020 12:25:27 +0000 (14:25 +0200)
bacula/scripts/baculabackupreport.in

index da962c4426d2664dcdadd14827f89b1fd874346b..e9a4f0e6c9b08c03471cb5ffc420170ae66876f9 100755 (executable)
 # ----------------
 server="@hostname@"
 admin="@job_email@"
-bcbin="/opt/bacula/bin/bconsole"
+bcbin="@sbindir@/bconsole"
 sendmail="/usr/sbin/sendmail"
-bcconfig="/opt/bacula/etc/bconsole.conf"
+bcconfig="@sysconfdir@/bconsole.conf"
 
 # Database variables
 # ------------------
-dbtype="pgsql"                          # Supported options are pgsql, mysql, mariadb
-db="bacula"
-dbuser="bacula"
-dbbin="/usr/bin/psql"
-# dbpass="-pPassword"   # Uncomment and set db password if one is used
+dbtype="@DEFAULT_DB_TYPE@"                          # Supported options are pgsql/postgresql, mysql, mariadb
+db="@db_name@"
+dbuser="@db_user@"
+dbbindir="/usr/bin"
+# dbpass="-p@db_password@"   # Uncomment and set db password if one is used
 
 # Formatting variables
 # --------------------
@@ -133,17 +133,17 @@ case ${dbtype} in
                 FROM Job \
                 WHERE (RealEndTime >= DATE_ADD(NOW(), INTERVAL -${hist} HOUR) OR JobStatus='R') \
                 ORDER BY ${sortfield} ${sortorder};" \
-                | ${dbbin} -u ${dbuser} ${dbpass} ${db} \
+                | ${dbbindir}/mysql -u ${dbuser} ${dbpass} ${db} \
                 | sed '/^JobId/d' )
                 ;;
 
-        pgsql )
+        pgsql|postgresql )
                 queryresult=$(echo "SELECT JobId, Name, StartTime, EndTime, Type, Level, JobStatus, JobFiles, JobBytes, \
                 AGE(EndTime, StartTime) as RunTime, JobErrors \
                 FROM Job \
                 WHERE (RealEndTime >= CURRENT_TIMESTAMP(2) - cast('${hist} HOUR' as INTERVAL) OR JobStatus='R') \
                 ORDER BY ${sortfield} ${sortorder};" \
-                | ${dbbin} -U ${dbuser} ${dbpass} ${db} -0t \
+                | ${dbbindir}/psql -U ${dbuser} ${dbpass} ${db} -0t \
                 | sed -e 's/|//g' -e '/^$/d' )
                 ;;
 
@@ -153,7 +153,7 @@ case ${dbtype} in
                 FROM Job \
                 WHERE (RealEndTime >= DATE_ADD(NOW(), INTERVAL -${hist} HOUR) OR JobStatus='R') \
                 ORDER BY ${sortfield} ${sortorder};" \
-                | ${dbbin} -u ${dbuser} -p${dbpass} ${db} -s -N )
+                | ${dbbindir}/mysql -u ${dbuser} -p${dbpass} ${db} -s -N )
                 ;;
 
         * )