I can't figure out what I'm missing. I'm running a query to see if there are any streams recording on my DVR before starting a scripted update. I'm guessing that it is viewing $VIDEO as a string instead of an int. I've tried everything I saw on google but it still comes back as $VIDEO is greater than 0, then sends me an email saying that it was delayed because there are 0 stream(s) recording.
I removed one of the t's in http due to link restriction.
Also, am I not using code tags correctly? I thought I was and I can see it treat my code differently than standard text.
Thanks!
------ Post updated at 10:20 AM ------
Holy shampoo my logic statement is backwards. Hold on while i fix it and try it again.
I guess it "worked" when $VIDEO was >0 because I was actually evaluating $Video, which was 0.
Thanks for working through this with me.
your nested grep ( grep '<MediaGrabOperation' | grep 'status="inprogress"' ) returns no matches given your sample curl output.
I'd suggest start off by capturing the output of curl in a file and debug the script statically first.
At this moment that's exactly what it should do. There are no recordings in progress so it should return 0. If there were recordings in progress there would be that many matches. If there are 0 matches then it should proceed with the update. If there are matches then it doesn't because the update would interrupt the recording.
I fixed the logic to If $VIDEO < 1
Everything works now.
Also, it might be more efficient NOT to store >800 lines of curl output in a variable to be echo-ed|grep-ed and wc-ed later.
I'd do it in one piped statement and store the count in a variable to be compared later.
My $.02