I'm trying to troubleshoot some problem on FreeBSD server that is intermittently (at random times) being blocked by a network firewall from downloading some file over HTTPS from a webserver. In an effort to understand what happens when the block happens, I need to run the following cURL:
curl --interface nic1 --verbose --insecure 'https://speed.hetzner.de/100MB.bin' > /dev/null
and then read the stderr of the command. However, since the problem happens on random times that cannot be expected, I want to run this curl once every 10 seconds and store the stderr in a file so that I can review it later, I used the following script (named cURLScript
) to achieve this:
#!/bin/sh while true do date echo "=================================" curl --interface nic1 --verbose --insecure 'https://speed.hetzner.de/100MB.bin' > /dev/null 2>&1 echo "" sleep 10 done
I then run the script:
/bin/sh cURLScript > log &
I expect that log
file would contain the stderr, however, it does not; the log
is missing the stderr:
Svr12loc:service 21] cat log Thu Mar 24 16:42:34 CET 2022 ================================= Thu Mar 24 16:43:03 CET 2022 ================================= Thu Mar 24 16:43:33 CET 2022 ================================= Thu Mar 24 16:44:02 CET 2022 ================================= Thu Mar 24 16:44:32 CET 2022 ================================= Thu Mar 24 16:45:00 CET 2022 =================================
Can someone suggest what is it I'm doing wrong here?