Skip to content

Instantly share code, notes, and snippets.

@mbernat
mbernat / watch.sh
Last active December 23, 2019 00:14
Automatically restart an esy binary after a rebuild
#!/usr/bin/env bash
APP=$1
PID="nope"
inotifywait -q -m -e create _esy/default |
while read -r filename event; do
if [[ "$event" == "CREATE build" ]]; then
if [[ "$(ps -ao '%p' | grep ${PID})" != "" ]]; then
kill -9 ${PID}
fi