Skip to content

Commit 19b1cb2

Browse files
committed
fix for first run poll
1 parent 9e40a21 commit 19b1cb2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

msg_watch/get_new.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ NEW=`curl http://adbg.herokuapp.com/messages 2>/dev/null`
33
if (( $? != 0)); then
44
exit $?
55
fi
6+
[[ -e last.json ]] || FIRST_RUN=1
67
touch new.json
78
mv new.json last.json
8-
echo $NEW | jq . > new.json
9+
curl http://adbg.herokuapp.com/messages 2>/dev/null | jq . > new.json
10+
if (( FIRST_RUN )); then
11+
echo "FIRST RUN"
12+
exit 0
13+
fi
914
diff -q last.json new.json
1015
if (( $? != 0 )) ; then
1116
echo "New Message"

0 commit comments

Comments
 (0)