Curl timing confusion

Michael Newman via curl-users <[email protected]> Thu, 22 Jan 2026 13:23:28 +0700
Newsgroups gmane.comp.web.curl.general
Message-ID <[email protected]>
--===============8479042928187021805==
Content-Type: multipart/signed;
	boundary="Apple-Mail=_25E698E8-CCD7-43C0-B52A-E7810B1EE3FE";
	protocol="application/pkcs7-signature";
	micalg=sha-256
Content-Transfer-Encoding: quoted-printable


--Apple-Mail=_25E698E8-CCD7-43C0-B52A-E7810B1EE3FE
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

I=E2=80=99m trying to figure out what I=E2=80=99ve done wrong with =
respect to limiting how much time curl takes to perform a single file =
upload.

Here=E2=80=99s the code I=E2=80=99m using.=20

for i in {1..3}
 do
        echo $'\n'"`date`" Upload Attempt  "$i" - $(hostname) >> "$log"

        curl -s -S -v -u mgnewman: \
	--connect-timeout 30 \
	--max-time 30 \
	--pubkey ~/.ssh/id_rsa.pub \
	-T $file $host &>>  $log

	err=3D$?

	echo $'\n'"`date`" Upload Ended "$err" - $(hostname) >> "$log"

        touch /home/pi/webcam/webcam.webp

        if [ $err -eq 0 ] ; then
                break
        fi
done

Note that I=E2=80=99m using a =E2=80=9Cdo loop=E2=80=9D rather than =
curl=E2=80=99s retry option because between each iteration I want to =
touch an existing image file to prevent watchdog from rebooting the =
machine which it does if the image is not refreshed in ten minutes.

I=E2=80=99m trying to limit each iteration of curl to 30 seconds, but =
that doesn=E2=80=99t seem to work. Here=E2=80=99s a fragment of my log =
file:

Wed Jan 21 23:37:24 +07 2026 Upload Attempt 3 - raspcondo

*   Trying 192.nnn.nnn.101...
* TCP_NODELAY set
* Connected to xxxxxxx.com (192.nnn.nnn.101) port 22 (#0)
* SSH MD5 fingerprint: 4b17cad500a405c850e118c1deec0f96
* SSH host check: 0, key: =
AAAAB3NzaC1yc2EAAAADAQABAAABAQCzCyhhdYNOn5Zgib7qhPKev$
* SSH authentication methods available: =
publickey,password,keyboard-interactive
* Using SSH public key file '/home/pi/.ssh/id_rsa.pub'
* Using SSH private key file '/home/pi/.ssh/id_rsa'
* Initialized SSH public key authentication
* Authentication complete
* Operation timed out after 30000 milliseconds with 0 out of 0 bytes =
received
* Closing connection 0
curl: (28) Operation timed out after 30000 milliseconds with 0 out of 0 =
bytes r$

Wed Jan 21 23:48:09 +07 2026 Upload Ended 28 - raspcondo

My conclusion is that I don=E2=80=99t understand how this works as it =
seems that around ten minutes elapsed between the time curl started =
(23:37:24) and the time it failed (23:48:09) with error 28.

Note that I realize the code is rather sloppy, but I=E2=80=99m just a =
hobbyist and that=E2=80=99s about the best I can do. Sorry.

Mike Newman
Korat, Thailand


--Apple-Mail=_25E698E8-CCD7-43C0-B52A-E7810B1EE3FE
Content-Disposition: attachment;
	filename=smime.p7s
Content-Type: application/pkcs7-signature;
	name=smime.p7s
Content-Transfer-Encoding: base64

MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCCAzAw
ggMsMIICFKADAgECAgpnUv530PgvBlmJMA0GCSqGSIb3DQEBCwUAMEQxFDASBgNVBAMTC01pa2Ug
TmV3bWFuMR8wHQYJKoZIhvcNAQkBFhBtZ25ld21hbkBtYWMuY29tMQswCQYDVQQGEwJUSDAeFw0y
MzAxMTEwMjA0MjdaFw0yODAxMTEwMjA0MjdaMEQxFDASBgNVBAMTC01pa2UgTmV3bWFuMR8wHQYJ
KoZIhvcNAQkBFhBtZ25ld21hbkBtYWMuY29tMQswCQYDVQQGEwJUSDCCASIwDQYJKoZIhvcNAQEB
BQADggEPADCCAQoCggEBANf2LFbtIBs7cqOAhfJIUX8zmyVagVcsWYhmBNhcbW11lEPsvWeaXuaG
bL93W5e/ihS4kddNTDA6G5s2nuFBNN+n2maQFARo0FNokiVgxIM1AQovVuqXM23vtviMoYghSf2B
py4yAWOOlbLmvZwzGPHP1gzad5NhKzUoBv6/fdUwwF5zfi2aujm5ai2YYtpLkZqekbJBIGmVOjgH
WceD1x78/o/MIW0QG6N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E6s5il/tjnMndpFvI5uChmLW9TK+7E20uXc1Gu92NIHnjGALGE+q7hZ4EUt3Wvw
yKmTcNfs41jc5crZqJSJPzMiG2EtaEM/mGU0n9zPAGTAQPt4FHBZV6uUnWzXUYH3RhN0/EAAAAAA
AAA=
--Apple-Mail=_25E698E8-CCD7-43C0-B52A-E7810B1EE3FE--

--===============8479042928187021805==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html

--===============8479042928187021805==--