-
Notifications
You must be signed in to change notification settings - Fork 270
/
redeploy-server
executable file
·46 lines (36 loc) · 1.99 KB
/
redeploy-server
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
#!/bin/bash
SDK_MAN_PATH=$HOME/.sdkman # change if running for different user (cron) and you are using sdkman and no standard java binary or export JAVA_HOME manually for this script to Java version 8
$SHELL --version
echo running as user: $(whoami)
echo with HOME: $HOME
echo and Java Home: $JAVA_HOME
#in case sdkman is used to have a JAVA 8 running; needed in cron jobs since .bash_rc will not be used
export SDKMAN_DIR="${SDK_MAN_PATH}"
[[ -s "${SDK_MAN_PATH}/bin/sdkman-init.sh" ]] && source "${SDK_MAN_PATH}/bin/sdkman-init.sh" && echo "found and intialized sdkman" && sdk list java # && sdk use #TODO use a Java 8 version here
set -x
echo $JAVA_HOME
mvn -v
#singleton bash sript: check if it is already running, if so terminate old instance (and its child processes)
# TODO use PID file or sth like this later
PID=`pgrep --oldest ${0##*/} | head -n 1` #get pid of (first started instance of) this script
PGRP=`ps -p $PID -o pgrp | head -n 2 | tail -n 1 | xargs` #get process-group for pid and trim whitespaces with xargs
[[ `pgrep ${0##*/} | wc -l` > 2 ]] && `kill -- -$PGRP` # if more than one instance of this script terminate process group (needed in order to close all forked processes like the extraction framework itself)
#fetch git and preserve local changes hopefully
export GIT_AUTHOR_NAME="DBpedia Server redeploy script"
export GIT_COMMITTER_NAME="DBpedia Server redeploy script"
export GIT_COMMITTER_EMAIL="[email protected]"
export GIT_AUTHOR_EMAIL="[email protected]"
printenv
git stash push
git pull
git stash pop
mvn install -Dskip=true -DskipTests -Dmaven.source.skip=true
#fetch data
cd core
../run download-mappings
../run download-ontology
cd ../server
#TODO create mapping stats, not important for extraction itself
#../run stats #4 required params: input dir, output dir, file suffix ('.gz', '.bz2' or ''), pretty-printing flag (true) may be followed by list of language codes
#../run stats create.mappings.stats.properties # only for template-test
../run server