-
-
Save eedgar/ee84120b7289c298e35c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################################## | |
# | |
# Copyright (C) Zenoss, Inc. 2007, all rights reserved. | |
# | |
# This content is made available according to terms specified in | |
# License.zenoss under the directory where your Zenoss product is installed. | |
# | |
############################################################################## | |
# THIS SCRIPT WILL BLOW AWAY YOUR DATABASE | |
# Use --xml option to this script to rebuild using DmdBuilder and the XML files | |
# Default is simply to reload from SQL dump | |
if [ -z "${ZENHOME}" ]; then | |
if [ -d /opt/zenoss ] ; then | |
ZENHOME=/opt/zenoss | |
else | |
echo "Please define the ZENHOME environment variable" | |
exit 1 | |
fi | |
fi | |
zengc=$ZENHOME/bin/zenglobalconf | |
# read configuration from global.conf | |
dbtype=$(${zengc} -p zodb-db-type) | |
host=$(${zengc} -p zodb-host) | |
port=$(${zengc} -p zodb-port) | |
user=$(${zengc} -p zodb-user) | |
userpass=$(${zengc} -p zodb-password) | |
admin=$(${zengc} -p zodb-admin-user) | |
adminpass=$(${zengc} -p zodb-admin-password) | |
dbname=$(${zengc} -p zodb-db) | |
zenoss stop | |
# Drop and recreate the ZEP event database | |
zeneventserver-create-db --dbtype $dbtype --dbhost $host --dbport $port --dbadminuser $admin --dbadminpass "${adminpass}" --dbuser $user --dbpass "${userpass}" --force | |
zenoss start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment