blob: 9ad5697f0145f5543a65d444d18130f006c8c268 (
plain)
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
|
#!/bin/sh
. "lib_handle.sh"
FIFO=/tmp/noti.fifo
FILE=/tmp/noti.txt
[ -p "${FIFO}" ] || mkfifo "${FIFO}"
exec 3<"${FIFO}"
exec 4>"${FIFO}"
tpid=""
cancel() {
[ -n "${tpid}" ] && kill "${tpid}" 2>/dev/null
tpid=""
}
while read n <&3; do
[ "${n}" = "-1" ] && { cancel; continue; }
case "${n}" in ''|*[!0-9]*) continue ;; esac
cancel
[ "${n}" -gt 0 ] || { :>"${FILE}"; notify_handle reload; continue; }
(
sleep "${n}"
:>"${FILE}"
notify_handle reload
) &
tpid=$!
done
|