forked from tenforce/docker-virtuoso
-
Notifications
You must be signed in to change notification settings - Fork 2
/
virtuoso.sh
47 lines (37 loc) · 1.4 KB
/
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
#!/bin/bash
cd /data
mkdir -p dumps
if [ ! -f ./virtuoso.ini ];
then
mv /virtuoso.ini . 2>/dev/null
fi
chmod +x /clean-logs.sh
mv /clean-logs.sh . 2>/dev/null
if [ ! -f "/.dba_pwd_set" ];
then
touch /sql-query.sql
if [ "$DBA_PASSWORD" ]; then echo "user_set_password('dba', '$DBA_PASSWORD');" >> /sql-query.sql ; fi
if [ "$SPARQL_UPDATE" = "true" ]; then echo "GRANT SPARQL_UPDATE to \"SPARQL\";" >> /sql-query.sql ; fi
virtuoso-t +wait && isql-v -U dba -P dba < /dump_nquads_procedure.sql && isql-v -U dba -P dba < /sql-query.sql && isql-v -U dba -P dba < /dump_one_graph_procedure.sql
kill $(ps aux | grep '[v]irtuoso-t' | awk '{print $2}')
touch /.dba_pwd_set
fi
if [ ! -f "/.data_loaded" ];
then
echo "starting data loading"
pwd="dba"
graph="http://localhost:8890/DAV"
if [ "$DBA_PASSWORD" ]; then pwd="$DBA_PASSWORD" ; fi
if [ "$DEFAULT_GRAPH" ]; then graph="$DEFAULT_GRAPH" ; fi
echo "ld_dir('toLoad', '*', '$graph');" >> /load_data.sql
echo "rdf_loader_run();" >> /load_data.sql
echo "exec('checkpoint');" >> /load_data.sql
echo "WAIT_FOR_CHILDREN; " >> /load_data.sql
echo "$(cat /load_data.sql)"
virtuoso-t +wait && isql-v -U dba -P "$pwd" < /load_data.sql
kill $(ps aux | grep '[v]irtuoso-t' | awk '{print $2}')
touch /.data_loaded
fi
chmod u+x /usr/local/virtuoso-opensource/var/lib/virtuoso/db/periodic_backup.sh
cron
virtuoso-t +wait +foreground