diff options
author | sanine <sanine.not@pm.me> | 2022-01-13 17:41:02 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-01-13 17:41:02 -0600 |
commit | 0ff62ea7886bdeff160682d3d5713c2c8a6dd4b1 (patch) | |
tree | c70d31f35c1e54a7fc01246eb6740d79aef0ccd0 /serve-http.sh |
initial commit
Diffstat (limited to 'serve-http.sh')
-rwxr-xr-x | serve-http.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/serve-http.sh b/serve-http.sh new file mode 100755 index 0000000..874b586 --- /dev/null +++ b/serve-http.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# this script is for previewing site changes ONLY!! it should not be used to +# actually serve a site. use apache or nginx or something for that. + +# launch webserver +python3 -m http.server --directory public/ & +server_pid="$!" +echo "server launched with PID $server_pid" + +# kill server on exit +trap "kill $server_pid && echo && echo \"bye!\"" EXIT + +# rebuild on file changes (inotifywait is from inotify-tools) +while inotifywait -qr --event modify .; do + echo "rebuilding site..." + argent + echo "done." +done |