forked from nytud/hunlp-GATE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgate-daemon
executable file
·62 lines (58 loc) · 1.46 KB
/
gate-daemon
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
#!/bin/bash
### BEGIN INIT INFO
# Provides: gate-server
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: GATE Server
# Description: Application written in Java to wrap
# GATE application with a simple REST API
### END INIT INFO
URL=http://localhost:8000
SELF=`realpath $0`
case "$1" in
start-bin)
export GATE_HOME=/opt/GATE
cd /opt/hunlp-GATE
./gate-server.sh &>./gate-server.log
;;
test-fast)
RESP=`wget -O- "$URL/process?run=QT,HFSTLemm&text=A%20kutya%20ugat"`
if [ `echo $RESP | grep -c "kutya+\[Nom\]"` -gt 0 ]; then
echo "Success"
else
echo "$RESP"
fi
;;
test-full)
RESP=`wget -O- "$URL/process?run=QT,HFSTLemm,ML3-PosLem-hfstcode,ML3-Dep,Preverb,ML3-Cons,huntag3-NP-pipe-hfstcode,IOB4NP,huntag3-NER-pipe-hfstcode,IOB4NER&text=A%20kutya%20ugat"`
if [ `echo $RESP | grep -c "kutya+\[Nom\]"` -gt 0 ]; then
echo "Success"
else
echo "$RESP"
fi
;;
init)
sleep 3
$SELF test-full
;;
start)
echo -n "Starting GATE Server..."
start-stop-daemon --start --quiet --background --exec $SELF -- start-bin
echo " Done"
$SELF init &
;;
stop)
echo -n "Stopping GATE Server..."
wget -qO- $URL/exit - &>/dev/null
echo " Done"
;;
restart)
$SELF stop
$SELF start
;;
*)
echo "Usage: $0 {start|stop|restart}" >&2
exit 1
esac