-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpresenter_update.sh
More file actions
executable file
·58 lines (45 loc) · 1.47 KB
/
presenter_update.sh
File metadata and controls
executable file
·58 lines (45 loc) · 1.47 KB
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
#!/bin/sh
set -e
set -x
SERVER_PORT=7782
DESTINATION_DIRECTORY=/tmp/output
# start WDK server
echo "$(date -u) starting server"
wdkServer SiteSearchData $SERVER_PORT -cleanCacheAtStartup &
echo "waiting for server to be available"
SERVER_AVAILABLE=false
start=$(date +%s)
while [ $(($(date +%s) - $start)) -lt 180 ]
# while true
do
echo "checking port $SERVER_PORT..."
if nc -zv localhost:$SERVER_PORT
then
echo 'server available'
SERVER_AVAILABLE=true
break
fi
sleep 1
done
if [ "$SERVER_AVAILABLE" = false ]; then
echo "ERROR: Server on port $SERVER_PORT failed to become available after 180 seconds" >&2
kill %1 2>/dev/null
exit 1
fi
echo "$(date -u) server available"
# make output dir and run commands to produce output
mkdir $DESTINATION_DIRECTORY
echo "$(date -u) starting ssCreateWdkRecordsBatch"
ssCreateWdkRecordsBatch dataset-presenter $PROJECT_ID http://localhost:$SERVER_PORT $DESTINATION_DIRECTORY --paramName projectId --paramValue $PROJECT_ID
echo "$(date -u) starting ssCreateWdkMetaBatch"
ssCreateWdkMetaBatch $SITE_BASE_URL/service/ $PROJECT_ID $DESTINATION_DIRECTORY
echo "produced files:"
echo
find $DESTINATION_DIRECTORY -type f -print0 | xargs -0 ls -al
# load produced output into solr
echo "$(date -u) starting ssLoadMultipleBatches"
ssLoadMultipleBatches $SOLR_URL $DESTINATION_DIRECTORY --replace
# shut down running WDK server started above
echo "$(date -u) Shutting down WDK"
kill %1
echo "$(date -u) DONE presenter_update"