-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathside_runner.sh
executable file
·48 lines (36 loc) · 1.13 KB
/
side_runner.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
#!/bin/bash
if [ ! -f lib/lib.sh ]
then
echo "Error: lib/lib.sh not found!"
echo "make sure you are in the root of the server repo"
exit 1
fi
source lib/lib.sh
if [ ! -x "$(command -v frontail)" ]
then
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
fi
if [ ! -x "$(command -v frontail)" ]
then
echo "Error: please run $(tput bold)npm i frontail -g$(tput sgr0)"
exit 1
fi
port="${CFG_PL_FRONTAIL_PORT:-9001}"
echo "*** server-plugin-frontail ***"
echo "starting side runner with the following config:"
echo "url=$CFG_PL_FRONTAIL_URL"
echo "port=$port"
# give the server time to start
sleep 10
# plugins get restarted on server restart
# so this logfile should always be current
# as long as the server does not rotate logs without restart
logfile="$(./show_log.sh --filepath)"
shutdown() {
log "shutting down frontail with pkill ..."
pkill -f -- "--disable-usage-stats $logfile"
}
trap shutdown EXIT
frontail -h 127.0.0.1 --port "$port" --url-path /frontail --disable-usage-stats "$logfile"