Running multiple instances of bash script fails

David Koski dkoski@sutinen.com
Fri Jun 28 20:11:54 GMT 2024


I developed a bash script to get SMART stats from hard drives and it has 
been working with success for years.  It is working for both Linux and 
Windows using Cygwin.  Recently I ran into a new installation of this 
script on a Server 2022 Standard host and found it failed.  On closer 
examination, I found it was more than an order of magnitude slower than 
on Linux.  There are many calls to external programs like grep, sed, awk 
and tr.  The script is called by a Zabbix agent and multiple querries 
are triggered at the same time. Not to be deterred, I added caching for 
the SMART output with file locking to prevent conflicts to speed things 
up.  But the call to smartctl was not nearly as much of a delay as the 
accumulated delays within the script.

After extensive debugging to a debug log, I can now see the script is 
terminating prematurely, except for the first call.  I have a trap 
command to report the event on exit of the script, but script is 
terminating in somewhat random places without getting trapped in 
instances where it otherwise fails to complete.  I can't see how this is 
not a bug in Cygwin.

Cygwin Setup version 2.932 (x86_64). Updates applied.

Any suggestions welcome.

Regards,
David Koski



More information about the Cygwin mailing list