-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-loop.sh
More file actions
executable file
·50 lines (41 loc) · 944 Bytes
/
make-loop.sh
File metadata and controls
executable file
·50 lines (41 loc) · 944 Bytes
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
delay=7
################ Example found in /usr/share/doc/util-linux/examples/getopt-parse.bash
TEMP=`getopt -o d: --long delay: -n "$0" -- "$@"`
if [ $? != 0 ] ; then echo "Abandon" >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
while true ; do
case "$1" in
-d|--delay)
delay=$2
shift 2 ;;
--) shift ; break ;;
*) echo "Internal error!" ; exit 1 ;;
esac
done
################ End example ##########################################################
last_notification=$(date '+%s')
duration=1
while sleep $duration
do
if ! make -q $* || [ "$duration" = "1" ]
then
reset
make $*
status=$?
while (( $status != 0 ))
do
make -st $*
notify-send "make error ($(date '+%H:%M:%S'))"
while make -q $*
do
sleep 1
done
reset
make $*
status=$?
done
fi
duration=$delay
done