Shell Would this script be difficult?

I have 3 systems on which a pkg upgrade often stalls and/or times out. Hoping for a switch to the command [ eventually ] to have an unattended restart of only the fetch portion, which would fix it, it seems, something along the lines of " if pkg upgrade while fetching goes 40 seconds without a download speed of 40kBs/second, delete the partially downloaded package specifically and restart the command anew, all without prompting..." ;
reading the man page, this could be assigned to -R, but in the meantime a shell wrapper using ifstat or some other could suffice. Wondering if anyone has done scripting of this
sort before in BSD so that I don't try to reinvent the most difficult code part...
 
I have 3 systems on which a pkg upgrade often stalls and/or times out.
Something I don't normally recommend doing but have you tried a different mirror? You might get sent to a badly reachable one based on your GeoIP. Sometimes just checking a few of the other mirrors could help determine which one is not performing for you.

Also try forcing IPv4 if you have IPv6 enabled. Lots of ISPs seem to maintain their IPv6 connectivity not as diligently as their IPv4 uplinks.
 
I changed the FreeBSD mirror to one maybe more reliable. However one of
the systems is GhostBSD which has had the problem more than the others, and did not want to post on its forum first due to the difficulty of maintaining that fork-or-feature-set full time. [ posting again because I rembered also the use of 'expect' for such a wrapper... ]
 
Back
Top