hot reload
USAGE : ./script.sh <scope_directory> <MainScript.py> EXAMPLE : ./script.sh my_dir main.pyunknown
powershell
2 years ago
411 B
5
Indexable
Never
#!/bin/bash directory="$1" script="$2" reference_hash=$(tar -cf - $directory | md5sum) python3 $2 & while true; do sleep 2 current_hash=$(tar -cf - $directory | md5sum) if [ "$reference_hash" != "$current_hash" ] ; then echo "[UPDATE] : change has been detected" # pkill -f $2 pkill -P $$ python3 $2 & reference_hash=$current_hash fi trap "pkill -P $$ ; exit 1" 2 3 done