diff --git a/module/idoutils/db/README b/module/idoutils/db/README old mode 100644 new mode 100755 index f2f58e6cd..d1a05738e --- a/module/idoutils/db/README +++ b/module/idoutils/db/README @@ -20,7 +20,8 @@ oracle/ scripts/ - - Install and Upgrade Scripts for IDOUtils MySQL + - Install Scripts for IDOUtils MySQL,Oracle and Postgresql + - edit defines within these scripts for your needs before running! queries/ - Example queries for selecting data diff --git a/module/idoutils/db/scripts/create_mysqldb.sh b/module/idoutils/db/scripts/create_mysqldb.sh new file mode 100755 index 000000000..d39852971 --- /dev/null +++ b/module/idoutils/db/scripts/create_mysqldb.sh @@ -0,0 +1,76 @@ +#!/bin/sh +#-- -------------------------------------------------------- +#-- create_mysqldb.sh +#-- DB definition for MySQL +#-- +#-- Copyright (c) 2009-2011 Icinga Development Team (http://www.icinga.org) +#-- +#-- current version: 2011-05-03 Thomas Dressler +#-- -- -------------------------------------------------------- + + +#set -x +#where to connect +#edit this! +DB=icinga +DBUSER=icinga +DBPASS=icinga +DBHOST=localhost +DBADMIN=root + +WD=`dirname $0` +cd $WD +WD=`pwd` +cd ../mysql + +echo "Enter password for mysql user '$DBADMIN' or if none" +read ROOTPASS +if [ -s "ROOTPASS" ];then + P=-p$ROOTPASS +fi +echo "drop existing DB $DB and user $DBUSER..." +mysql -u $DBADMIN -h $DBHOST $P mysql <$WD/create_mysqldb.log mysql <icinga_defines.sql + +fi + +#run sqlplus as sys +echo "Enter password for oracle user 'SYS' on $DB to drop and create new Tablespaces and user $DBUSER" +read SYSPASS +$SP /nolog <create_pgsqldb.log <create_icinga_objects_pgsqldb.log 2>&1 < /tmp/pgsql/pgsqldb.sh +chmod a+rx /tmp/pgsql/pgsqldb.sh + +#run it +#set -x +su - postgres -c /tmp/pgsql/pgsqldb.sh +RET=$? +mv -f /tmp/pgsql/*.log . +echo "Dont forget to modify pg_hba.conf to trust icinga!(see icinga documentation)" +rm -rf /tmp/pgsql +echo "Logfiles:" +ls -l *pgsql*.log +exit $RET \ No newline at end of file