rework server-side daemon to be reloadable via ssh
This commit is contained in:
parent
5f86f4cee7
commit
0191ce9f70
8 changed files with 38 additions and 39 deletions
27
admin/daemon.bash
Normal file
27
admin/daemon.bash
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source "${BASH_SOURCE%/*}/daemon/common.bash"
|
||||
build_log="/tmp/treehouse_build.log"
|
||||
|
||||
trap 'kill 0' EXIT
|
||||
|
||||
rm -f $reload_fifo
|
||||
mkfifo $reload_fifo
|
||||
|
||||
reload() {
|
||||
# This just kind of assumes regeneration doesn't take too long.
|
||||
kill "$treehouse_pid"
|
||||
cargo run --release -- serve --port 8082 > "$build_log" &
|
||||
treehouse_pid="$!"
|
||||
}
|
||||
|
||||
reload
|
||||
|
||||
while true; do
|
||||
read command < "$reload_fifo"
|
||||
case "$command" in
|
||||
reload)
|
||||
echo "Reloading"
|
||||
reload;;
|
||||
esac
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue