I have three Raspberry Pi 4s all running Buster which all perform essentially the same tasks once every two minutes.
• Capture a still image from a USB web cam using fswebcam
• Badge that image with location and weather data using convert from ImageMagick
• Upload the image using curl to a web host
One of the Pies is at my home where the Internet throughput is quite good and very reliable.
The other two Pies are at a condo where the internet throughput is poor and rather flakey.
Within the last month or so I've started to get multiple instances of curl error 28 at the condo Pies. Here's a fragment of my log for one of the Pies:
The actual curl error message:
So, there were many 28s (most not shown above) late on the night of the 14th, one just after midnight on the 15th and none since then.
Here's the code that I'm currently using to deal with this problem:
I'm using the "do loop" instead of curl's -retry because the loop allows me to insert a touch statement which attempts to prevent a watchdog file/change from rebooting the machine.
(Sometimes the USB bus on the Pies simply freezes up preventing the image capture. The only way I've found to fix this is to reboot the Pi.)
I can't help but thinking that there's a better way to deal with the curl errors, but nothing I've tried has worked very well.
• Capture a still image from a USB web cam using fswebcam
• Badge that image with location and weather data using convert from ImageMagick
• Upload the image using curl to a web host
One of the Pies is at my home where the Internet throughput is quite good and very reliable.
The other two Pies are at a condo where the internet throughput is poor and rather flakey.
Within the last month or so I've started to get multiple instances of curl error 28 at the condo Pies. Here's a fragment of my log for one of the Pies:
Code:
Wed Jan 14 22:16:48 +07 2026 Upload Ended 28 - raspmountainWed Jan 14 22:17:20 +07 2026 Upload Ended 28 - raspmountainWed Jan 14 22:18:37 +07 2026 Upload Ended 28 - raspmountainWed Jan 14 22:20:39 +07 2026 Upload Ended 28 - raspmountainWed Jan 14 22:21:10 +07 2026 Upload Ended 28 - raspmountainWed Jan 14 23:09:16 +07 2026 Upload Ended 28 - raspmountainThu Jan 15 00:16:43 +07 2026 Upload Ended 28 - raspmountainCode:
curl: (28) Operation timed out after 30000 milliseconds with 0 out of 0 bytes receivedHere's the code that I'm currently using to deal with this problem:
Code:
for i in {1..3} do echo $'\n'"`date`" Upload Attempt "$i" - $(hostname) >> "$log" curl -s -S -u mgnewman: \ --connect-timeout 30 \ --max-time 30 \ --retry 0 \ --retry-max-time 30 \ --pubkey ~/.ssh/id_rsa.pub \ -T $file $host &>> $log err=$? echo $'\n'"`date`" Upload Ended "$err" - $(hostname) >> "$log" touch /home/pi/webcam/webcammtn.webp if [ $err -eq 0 ] ; then break fidone (Sometimes the USB bus on the Pies simply freezes up preventing the image capture. The only way I've found to fix this is to reboot the Pi.)
I can't help but thinking that there's a better way to deal with the curl errors, but nothing I've tried has worked very well.
Statistics: Posted by Ratsima — Thu Jan 15, 2026 12:24 am