#!/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
Editor is loading...