From b77dd8e4480a23924f603be310c03c8312328cc3 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 15 Apr 2006 07:44:27 +0000 Subject: [PATCH] Reorganize examples git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2917 91ce42f0-d328-0410-95d8-f526ca767f89 --- .../database/bacula-sqlite_2_mysqldump.sh | 23 +++++++++++++++++++ .../{dbdump => database}/postgresql-dump.txt | 0 .../postgresql-mysql-dump.txt | 0 .../{dbdump => database}/sqlite2pgsql | 0 .../{ => reports}/bacula_mail_summary.sh | 0 bacula/examples/{ => reports}/baculareport.pl | 0 bacula/examples/{ => reports}/checkhost | 0 bacula/examples/{ => reports}/is_client_alive | 0 bacula/examples/{ => reports}/next_tape.sh | 0 bacula/examples/{ => reports}/pool-query.txt | 0 bacula/examples/{ => reports}/report.pl | 0 11 files changed, 23 insertions(+) create mode 100755 bacula/examples/database/bacula-sqlite_2_mysqldump.sh rename bacula/examples/{dbdump => database}/postgresql-dump.txt (100%) rename bacula/examples/{dbdump => database}/postgresql-mysql-dump.txt (100%) rename bacula/examples/{dbdump => database}/sqlite2pgsql (100%) rename bacula/examples/{ => reports}/bacula_mail_summary.sh (100%) rename bacula/examples/{ => reports}/baculareport.pl (100%) rename bacula/examples/{ => reports}/checkhost (100%) rename bacula/examples/{ => reports}/is_client_alive (100%) rename bacula/examples/{ => reports}/next_tape.sh (100%) mode change 100644 => 100755 rename bacula/examples/{ => reports}/pool-query.txt (100%) rename bacula/examples/{ => reports}/report.pl (100%) mode change 100644 => 100755 diff --git a/bacula/examples/database/bacula-sqlite_2_mysqldump.sh b/bacula/examples/database/bacula-sqlite_2_mysqldump.sh new file mode 100755 index 0000000000..4b7a703099 --- /dev/null +++ b/bacula/examples/database/bacula-sqlite_2_mysqldump.sh @@ -0,0 +1,23 @@ +#! /bin/sh +# +# bacula-sqlite_2_mysqldump.sh +# +# Convert a Bacula 1.36.2 Sqlite database to MySQL +# Originally Written by Nic Bellamy , Sept/Oct 2003. +# Modified by Silas Bennett , April 2006 for use with Bacula 1.36.2 +# + +if [ $1 == '-h' ] || [ $1 == '--help' ] ; then + echo `basename "$0"`" Usage:" + echo " "`basename $0`" takes a ASCII bacula sqlite database dump as an argument," + echo " and writes an SQL dump suitable for use with MySQL to STDOUT." + echo + echo " Example Use: "`basename $0`" bacula.sqlite.sql > bacula.mysql.sql" + echo " Example Use: "cat bacula.sqlite.sql | `basename $0`" - | mysql -p -u baculadb" + exit +fi + +# If $1 is '-' then cat will read /dev/stdin +cat $1 | +awk '/^INSERT INTO / && $3 != "NextId" && $3 != "Version" { print $0 }' | +sed '/^INSERT INTO [a-zA-Z]* VALUES(/s/(NULL)/(0)/g ; /^INSERT INTO [a-zA-Z]* VALUES(/s/(NULL,/(0,/g ; /^INSERT INTO [a-zA-Z]* VALUES(/s/,NULL,/,0,/g ; /^INSERT INTO [a-zA-Z]* VALUES(/s/,NULL,/,0,/g ; /^INSERT INTO [a-zA-Z]* VALUES(/s/,NULL)/,0)/g' diff --git a/bacula/examples/dbdump/postgresql-dump.txt b/bacula/examples/database/postgresql-dump.txt similarity index 100% rename from bacula/examples/dbdump/postgresql-dump.txt rename to bacula/examples/database/postgresql-dump.txt diff --git a/bacula/examples/dbdump/postgresql-mysql-dump.txt b/bacula/examples/database/postgresql-mysql-dump.txt similarity index 100% rename from bacula/examples/dbdump/postgresql-mysql-dump.txt rename to bacula/examples/database/postgresql-mysql-dump.txt diff --git a/bacula/examples/dbdump/sqlite2pgsql b/bacula/examples/database/sqlite2pgsql similarity index 100% rename from bacula/examples/dbdump/sqlite2pgsql rename to bacula/examples/database/sqlite2pgsql diff --git a/bacula/examples/bacula_mail_summary.sh b/bacula/examples/reports/bacula_mail_summary.sh similarity index 100% rename from bacula/examples/bacula_mail_summary.sh rename to bacula/examples/reports/bacula_mail_summary.sh diff --git a/bacula/examples/baculareport.pl b/bacula/examples/reports/baculareport.pl similarity index 100% rename from bacula/examples/baculareport.pl rename to bacula/examples/reports/baculareport.pl diff --git a/bacula/examples/checkhost b/bacula/examples/reports/checkhost similarity index 100% rename from bacula/examples/checkhost rename to bacula/examples/reports/checkhost diff --git a/bacula/examples/is_client_alive b/bacula/examples/reports/is_client_alive similarity index 100% rename from bacula/examples/is_client_alive rename to bacula/examples/reports/is_client_alive diff --git a/bacula/examples/next_tape.sh b/bacula/examples/reports/next_tape.sh old mode 100644 new mode 100755 similarity index 100% rename from bacula/examples/next_tape.sh rename to bacula/examples/reports/next_tape.sh diff --git a/bacula/examples/pool-query.txt b/bacula/examples/reports/pool-query.txt similarity index 100% rename from bacula/examples/pool-query.txt rename to bacula/examples/reports/pool-query.txt diff --git a/bacula/examples/report.pl b/bacula/examples/reports/report.pl old mode 100644 new mode 100755 similarity index 100% rename from bacula/examples/report.pl rename to bacula/examples/reports/report.pl -- 2.39.5