Skip to content

Commit

Permalink
[chores] Fix message getting logged twice and minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
devkapilbansal committed Aug 19, 2021
1 parent 623ca63 commit 75ddd0f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions openwrt-openwisp-monitoring/files/monitoring.agent
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ send_data() {
trap handle_sigusr1 USR1
# SIGUSR1 signal received, interrupt sleep and continue sending data
sleep "$INTERVAL" & wait $!
trap "" USR1
continue
fi
trap "" USR1
basefilename=${file##*/}
filename=${basefilename%.*}
# extra zeroes are added for nanoseconds precision
Expand All @@ -159,9 +159,7 @@ send_data() {
fi
# send data
data=$(cat "$file")
response_code=$($CURL_COMMAND -H "Content-Type: application/json" \
-d "$data" \
-v "$url")
response_code=$($CURL_COMMAND -H "Content-Type: application/json" -d "$data" "$url")
if [ "$response_code" = "200" ]; then
if [ "$verbose_mode" -eq "1" ]; then
logger -s "Data sent successfully." \
Expand All @@ -172,7 +170,7 @@ send_data() {
-p daemon.info
FAILING=0
fi
#remove saved data
# remove saved data
rm "$file"
break
else
Expand Down

0 comments on commit 75ddd0f

Please sign in to comment.