-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathstart-configurator.sh
executable file
·47 lines (39 loc) · 1.1 KB
/
start-configurator.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
#!/bin/sh
#
# Create inital config if necessary
#
mkdir -p $HOME/.local/share/actions-for-nautilus
[ -f $HOME/.local/share/actions-for-nautilus/config.json ] || cp ./sample-config.json $HOME/.local/share/actions-for-nautilus/config.json
if [ -f $PWD/javascript/jquery.min.js ]; then
JQUERY=$PWD/javascript/jquery.min.js
else
JQUERY=/usr/share/javascript/jquery/jquery.min.js
fi
export JQUERY
#
# Start the configuration server, then xdg-open the home page
#
#
# Kill existing instance
#
#pgrep -U $USER -f "python ./actions-for-nautilus-configurator.py" >> /tmp/a4n-start.log 2>&1
pkill -U $USER -f "python3 ./actions-for-nautilus-configurator.py"
RC=$?
#echo "after the kill - $RC" # >> /tmp/a4n-start.log
#
# Find a port
#
PORT=$(python3 ./find-a-port.py)
#echo "the port $PORT" # >> /tmp/a4n-start.log
#
# Start the server and detatch
#
python3 ./actions-for-nautilus-configurator.py $PORT & # >> /tmp/a4n-start.log 2>&1 &
RC=$?
#echo "server started $RC" # >> /tmp/a4n-start.log
#
# Start web page
#
xdg-open http://localhost:$PORT # >> /tmp/a4n-start.log 2>&1
RC=$?
#echo "XDG done $RC" # >> /tmp/a4n-start.log