2024-02-03 20:03:58 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
source "${BASH_SOURCE%/*}/daemon/common.bash"
|
|
|
|
|
2024-02-04 16:24:39 +01:00
|
|
|
echo "PATH: $PATH"
|
|
|
|
|
2024-02-03 20:13:27 +01:00
|
|
|
trap 'trap - SIGTERM && kill 0' SIGTERM SIGINT EXIT
|
2024-02-03 20:03:58 +01:00
|
|
|
|
|
|
|
rm -f $reload_fifo
|
|
|
|
mkfifo $reload_fifo
|
|
|
|
|
|
|
|
reload() {
|
|
|
|
# This just kind of assumes regeneration doesn't take too long.
|
2024-12-09 19:58:40 +01:00
|
|
|
cargo build --release > "$build_log" 2>&1
|
2024-02-03 20:03:58 +01:00
|
|
|
kill "$treehouse_pid"
|
2024-11-23 21:56:33 +01:00
|
|
|
cargo run --release -- serve --port 8082 > "$build_log" 2>&1 &
|
2024-02-03 20:03:58 +01:00
|
|
|
treehouse_pid="$!"
|
|
|
|
}
|
|
|
|
|
|
|
|
reload
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
read command < "$reload_fifo"
|
|
|
|
case "$command" in
|
|
|
|
reload)
|
|
|
|
echo "Reloading"
|
|
|
|
reload;;
|
|
|
|
esac
|
|
|
|
done
|