scripts/copy-image-resizer.sh
author František Kučera <franta-hg@frantovo.cz>
Mon, 17 Nov 2014 21:58:52 +0100
changeset 16 4634176c6602
parent 9 00d15f596bce
child 18 a5a36526ff71
permissions -rwxr-xr-x
logging: two log formatters: ColorfulConsoleFormatter and SimpleFormatter
franta-hg@9
     1
#!/bin/bash
franta-hg@9
     2
franta-hg@9
     3
#  copy-image-resizer
franta-hg@9
     4
#  Copyright © 2013 František Kučera (frantovo.cz)
franta-hg@9
     5
#
franta-hg@9
     6
#  This program is free software: you can redistribute it and/or modify
franta-hg@9
     7
#  it under the terms of the GNU General Public License as published by
franta-hg@9
     8
#  the Free Software Foundation, either version 3 of the License, or
franta-hg@9
     9
#  (at your option) any later version.
franta-hg@9
    10
#
franta-hg@9
    11
#  This program is distributed in the hope that it will be useful,
franta-hg@9
    12
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@9
    13
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@9
    14
#  GNU General Public License for more details.
franta-hg@9
    15
#
franta-hg@9
    16
#  You should have received a copy of the GNU General Public License
franta-hg@9
    17
#  along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@9
    18
franta-hg@9
    19
DIR="`dirname $0`";
franta-hg@9
    20
JAR="$DIR/../java/copy-image-resizer/dist/copy-image-resizer.jar";
franta-hg@9
    21
franta-hg@16
    22
# TODO: tune the path to the .jar file
franta-hg@16
    23
franta-hg@9
    24
LOGGER="-Djava.util.logging.config.class=info.globalcode.sql.dk.logging.LoggerInitializer";
franta-hg@9
    25
[ -n "$LOG_LEVEL" ] && LOGGER_LEVEL="-Dinfo.globalcode.sql.dk.logging.LoggerInitializer.level=$LOG_LEVEL";
franta-hg@9
    26
franta-hg@9
    27
CLASS_PATH="$JAR";
franta-hg@9
    28
franta-hg@9
    29
MAIN_CLASS="cz.frantovo.copyImageResizer.cli.CLIStarter";
franta-hg@9
    30
franta-hg@16
    31
# Customize logger output:
franta-hg@16
    32
LOGGER_INITIALIZER_CLASS="cz.frantovo.copyImageResizer.logging.ConsoleLoggerInitializer"; # colorful log for interactive work (human readable)
franta-hg@16
    33
LOGGER_INITIALIZER_CLASS="cz.frantovo.copyImageResizer.logging.SimpleLoggerInitializer";  # simple log for redirecting STDOUT to a file (machine readable)
franta-hg@16
    34
franta-hg@9
    35
LOGGER="-Djava.util.logging.config.class=$LOGGER_INITIALIZER_CLASS";
franta-hg@16
    36
franta-hg@16
    37
# by LOG_LEVEL variable you can set custom log level. Default is INFO. Possible values are: ALL, FINE, FINER, FINEST, CONFIG, INFO, OFF. SEVERE, WARNING (see java.util.logging.Level class)
franta-hg@16
    38
[ -n "$LOG_LEVEL" ] && LOGGER_LEVEL="-Dcz.frantovo.copyImageResizer.logging.AbstractInitializer.level=$LOG_LEVEL";
franta-hg@9
    39
franta-hg@9
    40
java $LOGGER $LOGGER_LEVEL -cp "$CLASS_PATH" $MAIN_CLASS "$@"
franta-hg@9
    41