scripts/sql-dk.sh
author František Kučera <franta-hg@frantovo.cz>
Thu, 25 Sep 2014 17:50:40 +0200
branchv_0
changeset 179 236332caeb29
parent 150 911b2d55bb08
child 188 54bacc7ed42b
permissions -rwxr-xr-x
Basic JMX management/reporting – counters for commands and records
franta-hg@85
     1
#!/bin/bash
franta-hg@85
     2
franta-hg@122
     3
# include user-defined overrides and customization
franta-hg@102
     4
if [ -f ~/.sql-dk/environment.sh ]; then # .sql-dk must match with DIR in Constants.java
franta-hg@150
     5
	. ~/.sql-dk/environment.sh
franta-hg@150
     6
else
franta-hg@150
     7
	mkdir -p ~/.sql-dk/
franta-hg@150
     8
	touch ~/.sql-dk/environment.sh
franta-hg@150
     9
	# link/copy support files for configuration:
franta-hg@150
    10
	[ -f ~/.sql-dk/config.xsd ] || ln -s /usr/share/doc/sql-dk/config.xsd ~/.sql-dk/config.xsd
franta-hg@150
    11
	[ -f ~/.sql-dk/config.rnc ] || ln -s /usr/share/doc/sql-dk/config.rnc ~/.sql-dk/config.rnc
franta-hg@150
    12
	[ -f ~/.sql-dk/config.xsl ] || gunzip < /usr/share/doc/sql-dk/config.xsl.gz > ~/.sql-dk/config.xsl # might not work in www browser if just symlinked
franta-hg@102
    13
fi
franta-hg@102
    14
franta-hg@122
    15
# Standard JDBC drivers
franta-hg@122
    16
[ -n "$STANDARD_JDBC" ] || STANDARD_JDBC=(
franta-hg@122
    17
	"/usr/share/java/postgresql-jdbc4.jar"
franta-hg@122
    18
	"/usr/share/java/mysql.jar"
franta-hg@122
    19
);
franta-hg@122
    20
franta-hg@122
    21
# Additional JDBC drivers might be specified in CUSTOM_JDBC array
franta-hg@122
    22
# Plugins (formatters etc.) might be specified in PLUGINS array
franta-hg@122
    23
franta-hg@122
    24
# JAR containing SQL-DK application
franta-hg@111
    25
[ -n "$JAR" ] || JAR="/usr/share/sql-dk/sql-dk.jar";
franta-hg@85
    26
franta-hg@122
    27
CLASS_PATH="$JAR";
franta-hg@122
    28
franta-hg@122
    29
for e in "${STANDARD_JDBC[@]}" "${CUSTOM_JDBC[@]}" "${PLUGINS[@]}"; do
franta-hg@122
    30
	CLASS_PATH="$CLASS_PATH:$e";
franta-hg@122
    31
done
franta-hg@122
    32
franta-hg@122
    33
franta-hg@85
    34
MAIN_CLASS="info.globalcode.sql.dk.CLIStarter";
franta-hg@85
    35
franta-hg@85
    36
LOGGER="-Djava.util.logging.config.class=info.globalcode.sql.dk.logging.LoggerInitializer";
franta-hg@85
    37
[ -n "$LOG_LEVEL" ] && LOGGER_LEVEL="-Dinfo.globalcode.sql.dk.logging.LoggerInitializer.level=$LOG_LEVEL";
franta-hg@85
    38
franta-hg@122
    39
java $LOGGER $LOGGER_LEVEL -cp "$CLASS_PATH" $MAIN_CLASS "$@"