forked from loklak/loklak_server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstallation.sh
executable file
·49 lines (39 loc) · 1.29 KB
/
installation.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
#!/usr/bin/env bash
# If you're looking for the variables, please go to bin/.preload.sh
# Make sure we're on project root
cd $(dirname $0)/..
# Execute preload script
source bin/.preload.sh
echo "starting loklak installation"
echo "startup" > $STARTUPFILE
cmdline="$cmdline -server -classpath $CLASSPATH -Dlog4j.configurationFile=$LOGCONFIG org.loklak.LoklakInstallation >> data/loklak.log 2>&1 &";
eval $cmdline
PID=$!
echo $PID > $PIDFILE
while [ -f $STARTUPFILE ] && [ $(ps -p $PID -o pid=) ]; do
if [ $(cat $STARTUPFILE) = 'done' ]; then
break
else
sleep 1
fi
done
if [ -f $STARTUPFILE ] && [ $(ps -p $PID -o pid=) ]; then
CUSTOMPORT=$(grep -iw 'port.http' conf/config.properties | sed 's/^[^=]*=//' );
LOCALHOST=$(grep -iw 'shortlink.urlstub' conf/config.properties | sed 's/^[^=]*=//');
echo "loklak installation started at port $CUSTOMPORT, open your browser at $LOCALHOST"
rm -f $STARTUPFILE
echo "waiting for installation to finish"
wait "$PID"
if [ $? -eq 0 ]; then
echo "loklak installation finished"
echo 'done' > $INSTALLATIONCONFIG
else
echo "loklak installation aborted"
fi
exit 0
else
echo "loklak installation failed to start. See data/loklag.log for details. Here are the last logs:"
tail data/loklak.log
rm -f $STARTUPFILE
exit 1
fi