Skip to content

Commit 06be32d

Browse files
[fix] Fixed cmd line too long: pass file path to curl #159
Closes #159
1 parent 27c6fb4 commit 06be32d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

openwisp-monitoring/files/monitoring.agent

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,7 @@ send_data() {
151151
fi
152152
filename="$TMP_DIR/$filename"
153153
# check if the data file exist
154-
if [ -f "$filename" ]; then
155-
data=$(cat "$filename")
156-
else
154+
if ! [ -f "$filename" ]; then
157155
[ "$VERBOSE_MODE" -eq "1" ] && logger -s "data file $filename not found." \
158156
-p daemon.info
159157
continue
@@ -176,7 +174,7 @@ send_data() {
176174
break
177175
fi
178176
# send data
179-
response_code=$($CURL_COMMAND -H "Content-Type: application/json" -d "$data" "$url")
177+
response_code=$($CURL_COMMAND -H "Content-Type: application/json" -d "@$filename" "$url")
180178
if [ "$response_code" = "200" ]; then
181179
success=$((success + 1))
182180
if [ "$VERBOSE_MODE" -eq "1" ]; then

0 commit comments

Comments
 (0)