-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrunUpdate.sh
executable file
·103 lines (91 loc) · 2.57 KB
/
runUpdate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/env bash
set -e
if [ -r /etc/default/wdqs-updater ]; then
. /etc/default/wdqs-updater
fi
MAIN=org.wikidata.query.rdf.tool.Update
HOST=http://localhost:9999
CONTEXT=bigdata
LOG_DIR=${LOG_DIR:-"/var/log/wdqs"}
if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]] ; then
GC_LOGS=${GC_LOGS:-"-Xlog:gc:${LOG_DIR}/wdqs-updater_jvm_gc.%p.log \
-Xlog:gc* \
-XX:+UnlockExperimentalVMOptions \
-XX:G1NewSizePercent=20 \
-XX:+ParallelRefProcEnabled"}
else
GC_LOGS=${GC_LOGS:-"-Xloggc:${LOG_DIR}/wdqs-updater_jvm_gc.%p.log \
-XX:+PrintGCDetails \
-XX:+PrintGCDateStamps \
-XX:+PrintGCTimeStamps \
-XX:+PrintAdaptiveSizePolicy \
-XX:+PrintReferenceGC \
-XX:+PrintGCCause \
-XX:+PrintGCApplicationStoppedTime \
-XX:+PrintTenuringDistribution \
-XX:+UseGCLogFileRotation \
-XX:NumberOfGCLogFiles=10 \
-XX:GCLogFileSize=20M"}
fi
EXTRA_JVM_OPTS=${EXTRA_JVM_OPTS:-""}
LOG_CONFIG=${LOG_CONFIG:-""}
NAMESPACE=wdq
UPDATER_OPTS=${UPDATER_OPTS:-""}
while getopts m:h:c:n:l:t:sSNv option
do
case "${option}"
in
m) MAIN=${OPTARG};;
h) HOST=${OPTARG};;
c) CONTEXT=${OPTARG};;
n) NAMESPACE=${OPTARG};;
l) LANGS=${OPTARG};;
t) TMO=${OPTARG};;
s) SKIPSITE=1;;
S) NO_SERVICE=1;;
N) NOEXTRA=1;;
v) VERBOSE_LOGGING="true";;
esac
done
# allow extra args
shift $((OPTIND-1))
if [ -z "$NAMESPACE" ]
then
echo "Usage: $0 -n <namespace> [-h <host>] [-c <context>] [-S] [-v]"
exit 1
fi
if [ -z "$TMO" ]; then
TIMEOUT_ARG=
else
TIMEOUT_ARG="-Dorg.wikidata.query.rdf.tool.rdf.RdfRepository.timeout=$TMO"
fi
if [ -z "$LANGS" ]; then
ARGS=
else
ARGS="--labelLanguage $LANGS --singleLabel $LANGS"
fi
if [ ! -z "$SKIPSITE" ]; then
ARGS="$ARGS --skipSiteLinks"
fi
LOG_OPTIONS=""
# if not running as a service, use the default log file
if [ ! -z "$NO_SERVICE" ]; then
LOG_CONFIG=""
fi
if [ ! -z "$VERBOSE_LOGGING" ]; then
LOG_OPTIONS="-Dlogback.configurationFile=logback-verbose.xml"
elif [ ! -z "$LOG_CONFIG" ]; then
LOG_OPTIONS="-Dlogback.configurationFile=${LOG_CONFIG}"
fi
# No extra options - for running secondary updaters, etc.
if [ ! -z "$NOEXTRA" ]; then
EXTRA_JVM_OPTS=""
GC_LOGS=""
fi
# TODO dont hard code CLASSPATH for wbstack.. as we let everything else be passed in..
CLASSPATH=/wdqsup/wbstackqs.jar
SPARQL_URL=$HOST/$CONTEXT/namespace/$NAMESPACE/sparql
echo "Updating via $SPARQL_URL"
exec java -cp ${CLASSPATH} ${GC_LOGS} ${LOG_OPTIONS} ${EXTRA_JVM_OPTS} \
${TIMEOUT_ARG} ${UPDATER_OPTS} \
${MAIN} ${ARGS} "$@"