add admin scripts over from treehouse

would be nice to rewrite these as a standalone utility that integrates with Nix someday i guess
This commit is contained in:
りき萌 2024-08-23 22:37:49 +02:00
parent be6a47ae13
commit 384e64009e
6 changed files with 64 additions and 0 deletions

28
admin/daemon.bash Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
source "${BASH_SOURCE%/*}/daemon/common.bash"
echo "PATH: $PATH"
trap 'trap - SIGTERM && kill 0' SIGTERM SIGINT EXIT
rm -f $reload_fifo
mkfifo $reload_fifo
reload() {
# This just kind of assumes recompilation doesn't take too long.
kill "$rkgk_pid"
cargo run --release -- serve --port 8083 > "$build_log" 2>&1 &
rkgk_pid="$!"
}
reload
while true; do
read command < "$reload_fifo"
case "$command" in
reload)
echo "Reloading"
reload;;
esac
done