-
Notifications
You must be signed in to change notification settings - Fork 0
/
rerun.sh
executable file
·36 lines (30 loc) · 962 Bytes
/
rerun.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# get the current path
CURPATH=`pwd`
mkdir /tmp/planner_logs
OS=`uname`
function act_on_event {
file=$1
if [[ $file == *.go || $file == *.html ]]; then
echo $file
FILECHANGE=${dir}${file}
# convert absolute path to relative
FILECHANGEREL=`echo "$FILECHANGE" | sed 's_'$CURPATH'/__'`
make
make test
killall planner
./target/planner -v=2 -log_dir="/tmp/planner_logs" -config=./scripts/planner.cfg &
echo ""
echo "============================================================================="
echo ""
fi
}
if [[ $OS == "Linux" ]]; then
inotifywait -m -r --timefmt '%d/%m/%y %H:%M' --format '%T %w %f' \
-e moved_to . | while read date time dir file; do
act_on_event $file
done
fi
if [[ $OS == "Darwin" ]]; then
fswatch
fi