You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2016/10/04 14:48:09 UTC
svn commit: r1763286 - in /uima/uima-ducc/trunk/src/main/admin: cron/
cron/db_tool.crontab.example db_tool
Author: degenaro
Date: Tue Oct 4 14:48:09 2016
New Revision: 1763286
URL: http://svn.apache.org/viewvc?rev=1763286&view=rev
Log:
UIMA-5122 Database (db) admin tool for save and restore
Added:
uima/uima-ducc/trunk/src/main/admin/cron/
uima/uima-ducc/trunk/src/main/admin/cron/db_tool.crontab.example
Modified:
uima/uima-ducc/trunk/src/main/admin/db_tool
Added: uima/uima-ducc/trunk/src/main/admin/cron/db_tool.crontab.example
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/cron/db_tool.crontab.example?rev=1763286&view=auto
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/cron/db_tool.crontab.example (added)
+++ uima/uima-ducc/trunk/src/main/admin/cron/db_tool.crontab.example Tue Oct 4 14:48:09 2016
@@ -0,0 +1,34 @@
+
+# Example crontab to backup DUCC database
+
+# -----------------------------------------------------------------------
+# 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.
+# -----------------------------------------------------------------------
+
+DB_TOOL=/home/ducc/ducc_runtime/admin/db_tool
+DB_BKDIR=/backups/ducc/backup_db
+
+# Revise the day-of-week backup each day at 3:30 AM
+
+30 3 * * 0 $DB_TOOL --save-overwrite $DB_BKDIR/Sun.tar.gz 1>$DB_BKDIR/Sun.backup.log 2>&1
+30 3 * * 1 $DB_TOOL --save-overwrite $DB_BKDIR/Mon.tar.gz 1>$DB_BKDIR/Mon.backup.log 2>&1
+30 3 * * 2 $DB_TOOL --save-overwrite $DB_BKDIR/Tue.tar.gz 1>$DB_BKDIR/Tue.backup.log 2>&1
+30 3 * * 3 $DB_TOOL --save-overwrite $DB_BKDIR/Wed.tar.gz 1>$DB_BKDIR/Wed.backup.log 2>&1
+30 3 * * 4 $DB_TOOL --save-overwrite $DB_BKDIR/Thu.tar.gz 1>$DB_BKDIR/Thu.backup.log 2>&1
+30 3 * * 5 $DB_TOOL --save-overwrite $DB_BKDIR/Fri.tar.gz 1>$DB_BKDIR/Fri.backup.log 2>&1
+30 3 * * 6 $DB_TOOL --save-overwrite $DB_BKDIR/Sat.tar.gz 1>$DB_BKDIR/Sat.backup.log 2>&1
Modified: uima/uima-ducc/trunk/src/main/admin/db_tool
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/db_tool?rev=1763286&r1=1763285&r2=1763286&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/db_tool (original)
+++ uima/uima-ducc/trunk/src/main/admin/db_tool Tue Oct 4 14:48:09 2016
@@ -31,7 +31,6 @@ from optparse import OptionParser
import logging
from numpy import outer
-logging.basicConfig(format='%(asctime)s %(message)s',level=logging.DEBUG)
from ducc_util import DuccUtil
@@ -55,10 +54,27 @@ class DbToolOptionParser(OptionParser):
# See --help
class Logger():
-
+
def __init__(self, options):
self.options = options
+ #Get the root logger
+ logger = logging.getLogger()
+ #Have to set the root logger level, it defaults to logging.WARNING
+ logger.setLevel(logging.NOTSET)
+
+ formatter = logging.Formatter('%(asctime)s %(message)s')
+
+ logging_handler_out = logging.StreamHandler(sys.stdout)
+ logging_handler_out.setLevel(logging.INFO)
+ logging_handler_out.setFormatter(formatter)
+ logger.addHandler(logging_handler_out)
+
+ #logging_handler_err = logging.StreamHandler(sys.stderr)
+ #logging_handler_err.setLevel(logging.WARNING)
+ #logging_handler_err.setFormatter(formatter)
+ #logger.addHandler(logging_handler_err)
+
def info(self, text):
if(self.options.var_quiet):
return