-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_virtuoso.sh
executable file
·76 lines (45 loc) · 1.49 KB
/
start_virtuoso.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
#!/bin/bash
source scripts/virtuoso-db.sh
which isql &> /dev/null
if [ $? != 0 ] ; then
echo "isql: command not found..."
echo "Please install Virtuoso (https://virtuoso.openlinksw.com/)."
exit 1
fi
if [ -z $VIRTUOSO_HOME ] ; then
echo "Need to set VIRTUOSO_HOME."
exit 1
fi
if [ ! -d $VIRTUOSO_HOME ] ; then
echo "$VIRTUOSO_HOME is not directory."
exit 1
fi
isql $VIRTUOSO_DB_PORT $VIRTUOSO_DB_USER $VIRTUOSO_DB_PASS exec="status();" &> /dev/null
if [ $? = 0 ] ; then
isql $VIRTUOSO_DB_PORT $VIRTUOSO_DB_USER $VIRTUOSO_DB_PASS exec='grant select on "DB.DBA.SPARQL_SINV_2" to "SPARQL";'
isql $VIRTUOSO_DB_PORT $VIRTUOSO_DB_USER $VIRTUOSO_DB_PASS exec='grant execute on "DB.DBA.SPARQL_SINV_IMP" to "SPARQL";'
echo "virtuoso is already running."
exit 0
fi
VIRTUOSO_DATA_DIR=$VIRTUOSO_HOME/var/lib/virtuoso/db
echo "start virtuoso (local)"
cd $VIRTUOSO_DATA_DIR; virtuoso-t
pid=`pidof virtuoso-t` || exit 1
oom_score_adj=`cat /proc/$pid/oom_score_adj`
echo "pid: "$pid
echo "oom_score_adj: "$oom_score_adj
iter=1
while true ; do
sleep 30
isql $VIRTUOSO_DB_PORT $VIRTUOSO_DB_USER $VIRTUOSO_DB_PASS exec="status();" &> /dev/null
if [ $? = 0 ] ; then
break
elif [ $iter > 6 ] ; then
echo Failed.
break
fi
let iter++
done
isql $VIRTUOSO_DB_PORT $VIRTUOSO_DB_USER $VIRTUOSO_DB_PASS exec='grant select on "DB.DBA.SPARQL_SINV_2" to "SPARQL";'
isql $VIRTUOSO_DB_PORT $VIRTUOSO_DB_USER $VIRTUOSO_DB_PASS exec='grant execute on "DB.DBA.SPARQL_SINV_IMP" to "SPARQL";'
echo OK.