I am trying to send the log file to my server but I am getting error while running the code.
This is for RPI running Raspbian Buster Lite
#!/bin/sh
ping -q -c5 google.com > /dev/null
if [ $? -eq 0 ]
then
echo "$(date) - Connected" >> /home/weewx/internet-connection-status.log
statuslog=$(cat /home/weewx/internet-connection-status.log)
curl -d {$statuslog} -H "Content-Type: application/json" -X PUT [server url here]
if [ $? -eq 200 ]
then
truncate -s 0 /home/weewx/internet-connection-status.log
fi
else
echo "$(date) - Not Connected" >> /home/weewx/internet-connection-status.log
fi
curl: option -: is unknown curl: try 'curl --help' or 'curl
--manual' for more information