blob: 7a25bc052ec49fe7d041a9f78ccd1a016d6a75c9 [file] [log] [blame]
#!/usr/bin/env python
# -----------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# -----------------------------------------------------------------------
import os
import sys
from optparse import HelpFormatter
from optparse import OptionGroup
from optparse import OptionParser
from ducc_util import DuccUtil
from ducc_base import find_ducc_home
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# +
# + db_start
# +
# + purpose: start DUCC's Cassandra database
# +
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class DbStart(DuccUtil):
def main(self, argv):
usage = 'usage: use this command to start the DUCC database, regardless of ducc.database.automanage in ducc.properties'
parser = OptionParser(usage)
options, args = parser.parse_args()
if ( not self.verify_jvm() ):
sys.exit(1);
try:
if ( not self.db_start() ):
print 'Failed to start or connect to the database.'
sys.exit(1)
except:
# print e
print sys.exc_info()[0], 'Cannot start the database.'
sys.exit(1)
if __name__ == '__main__':
DUCC_HOME = find_ducc_home()
propsfile = DUCC_HOME + '/resources/site.ducc.properties'
if ( not os.path.exists(propsfile) ):
print '\n>> ERROR >> Missing site.ducc.properties -- please run ducc_post_install\n'
sys.exit(99)
instance = DbStart(merge=True)
instance.main(sys.argv[1:])