Is there a way to test if a root file is “good” from a bash script? I’m trying to write a script that resubmits failed jobs to our batch system. These particular root files have a no keys error when opened:
Warning in <TFile::Init>: file myfile.root probably not closed, trying to recover
Warning in <TFile::Init>: no keys recovered, file has been made a Zombie
I have a hint of what causes the error in my log files but the error only causes a problem sometimes
I have the -e option. I noticed the -q option doesn’t seem to be working either as after the command it leaves me in the root environment. The root version I’m working with is 5.33/02 in case that is relevant
Unfortunately I don’t have the option to upgrade. I was able to upgrade from 5.26/00 to 5.33/02 but it was the newest version of root capable of being run on the system I’m forced to use. Is it possible to construct a command capable of checking the root files with that version?
If that’s the case, I suggest you write a C++ program or a ROOT macro rather than a bash script: you can easily write a C++ program that takes a filename as argument, opens it with TFile, checks the output of TFile::IsZombie and returns non-zero if IsZombie() is true, e.g.