delphi.market/hotreload.sh

36 lines
615 B
Bash
Raw Normal View History

2023-09-09 20:52:50 +00:00
#!/usr/bin/env bash
PID=$(pidof delphi.market)
set -e
echo ":: remote port forwarding for dev1.delphi.market ::"
ssh -fnNR 4322:localhost:4321 dev1.delphi.market
echo
2023-09-09 20:52:50 +00:00
function restart_server() {
2023-09-09 20:52:51 +00:00
set +e
2023-09-09 20:52:50 +00:00
[[ -z "$PID" ]] || kill -15 $PID
ENV=development make build -B
2023-09-09 20:52:51 +00:00
set -e
2024-07-12 18:41:41 +00:00
./delphi.market 2>&1 &
2023-09-09 20:52:50 +00:00
PID=$(pidof delphi.market)
}
function restart() {
2023-09-09 20:52:50 +00:00
restart_server
date +%s.%N > public/hotreload
}
function cleanup() {
rm -f public/hotreload
[[ -z "$PID" ]] || kill -15 $PID
}
trap cleanup EXIT
restart
while inotifywait -r -e modify db/ env/ lib/ lnd/ public/ server/; do
restart
2023-09-09 20:52:50 +00:00
done