Skip to content

Instantly share code, notes, and snippets.

@mfurquimdev
Created June 30, 2021 10:38
Show Gist options
  • Select an option

  • Save mfurquimdev/202c97845686901cb0715d12db68b47c to your computer and use it in GitHub Desktop.

Select an option

Save mfurquimdev/202c97845686901cb0715d12db68b47c to your computer and use it in GitHub Desktop.
Execute command on changing file (kills it if it had previously ran)
inotifywait -q -m -e close_write tasks/behaviour_training.py | while read -r filename event; do echo "train@$train_pid"; if [ -n "$train_pid" ]; then echo "Killing"; kill $train_pid; fi; echo "Running"; pipenv run train& train_pid="$!"; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment