forked from dbpedia/extraction-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·46 lines (38 loc) · 1.63 KB
/
run
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
#!/bin/bash
# Shortcut for mvn scala:run -Dlauncher=... -DaddArgs=...
# Must be called with one of the modules (core/, dump/, ...) as current directory.
# Example:
# extraction_framework/core> ../run LAUNCHER ARG1 ARG2 ARG3
# is equivalent to
# extraction_framework/core> mvn scala:run "-Dlauncher=LAUNCHER" "-DaddArgs=ARG1|ARG2|ARG3"
LAUNCHER="$1"
SLACK=false
ADD_ARGS="$2"
if [[ $ADD_ARGS == log-slack* ]] ;
then
ADD_ARGS=""
SLACK=${ADD_ARGS#*log-slack=}
fi
for ARG in ${@:3}
do
ADD_ARGS="$ADD_ARGS|$ARG"
done
#insert parameter for the SlackForwarder script below
#to show results of an extraction step in slack, add 'msg-slack' as second parameter (after the LAUNCHER)
SlackUrl="https://hooks.slack.com/services/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"
SlackRegexMap="$HOME/IDEAprojects/extraction-framework/scripts/slackRegexMap.json"
LogDir="$HOME/IDEAprojects/logs"
# export MAVEN_OPTS='-Xmx4096M -XX:MaxPermSize=1024M -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGC -XX:+PrintGCTimeStamps'
# export MAVEN_DEBUG='-X -e'
# if we're not on a terminal, use batch mode to avoid ugly log files
[ ! -t 1 ] && BATCH="-B"
if [[ $SLACK != false && $SlackUrl == https://hooks.slack.com/services* ]] ;
then
#mvn $MAVEN_DEBUG $BATCH scala:run "-Dlauncher=SlackForwarder" "-DaddArgs=$SlackUrl|$SlackRegexMap|$LogDir|$1|$SLACK" &
sleep 5
PID="$(ps ax | grep java | grep extraction.scripts.SlackForwarder | tail -1 | sed -n -E 's/([0-9]+).*/\1/p' | xargs)"
echo $PID
mvn $MAVEN_DEBUG -B scala:run "-Dlauncher=$LAUNCHER" "-DaddArgs=$ADD_ARGS" &> "/proc/$PID/fd/0"
else
mvn $MAVEN_DEBUG $BATCH scala:run "-Dlauncher=$LAUNCHER" "-DaddArgs=$ADD_ARGS"
fi