First of all I apologize for my late reply, but I couldn't examine and study your script before.
Then, I really want to thank you for the effort you specifically did for me, editing your script, I really apreeciated it.
I actually needed much less, because I have a script which perform a series of operation.
So, I only needed to read if any of the readers is engaged and assign this to a variable.
Depending on it I'll then have various commands.
I saw that this command:
cat /tmp/test-oscam-api.xml | sed -rn '/name="'$READER_LABEL'"/,/times/p'
creates a file which would be useful, indeed, ecm.info which contains, above all, the reader used at the moment.
And I thought I could use it by the sed command.
But, the problem is that it deletes the file when no readers is used (that means Oscam is not actually used, at moment, by a channel or a recording going on).
My knowledge of sed command is limited and I tried different options but I did not manage to avoid the deleting of ecm.info.
Is that possible. Or is simply possible to have a way for a sort of yes/no answer to the question: is Oscam decrypting any channels at the moment?